{"_id":"@budgetbuddyde/logger","_rev":"4-6011cf56e491283805cce46c01b3a418","name":"@budgetbuddyde/logger","dist-tags":{"latest":"0.1.1"},"versions":{"0.0.1":{"name":"@budgetbuddyde/logger","version":"0.0.1","keywords":["logger.js","logging","utility"],"author":{"name":"Thorben Klein"},"license":"MIT","_id":"@budgetbuddyde/logger@0.0.1","maintainers":[{"name":"tklein1801","email":"thorb.klein1801@gmail.com"}],"homepage":"https://github.com/budgetbuddyde/logger","bugs":{"url":"https://github.com/budgetbuddyde/logger/issues"},"dist":{"shasum":"e2c01a9e968b44ef32b57fbf218eb3020bb650e5","tarball":"https://registry.npmjs.org/@budgetbuddyde/logger/-/logger-0.0.1.tgz","fileCount":35,"integrity":"sha512-nfJYGx10Ui3cVcymq9lOIzjF4o/5dqtMTg8mCObDsE2dNFMHmbr4OXrbozPWJFk0bG2yXSrnMC/QY/dLCacu/A==","signatures":[{"sig":"MEUCIEaEP+1D98FQ3rIxEQl5hBBEVfIapc4YvbcHVk8szPUdAiEAm9x3YfRrIcmlgDbb3MerJjiAL4FlmB50tvE/J61M5IY=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":46127},"main":"lib/index.js","types":"lib/index.d.ts","gitHead":"a980130e60fc9a06a01ee3d798fa880351021e35","scripts":{"lint":"biome lint --write","test":"vitest run --silent","build":"rimraf lib && tsc","check":"biome check --error-on-warnings","format":"biome format --write","pretest":"npm run check","test:watch":"vitest"},"_npmUser":{"name":"tklein1801","email":"thorb.klein1801@gmail.com"},"repository":{"url":"git+https://github.com/budgetbuddyde/logger.git","type":"git"},"_npmVersion":"10.8.2","description":"![CI](https://ci.tools.tklein.it/api/v1/teams/main/pipelines/logger.js/badge) ![NPM Version](https://img.shields.io/npm/v/%40tklein1801%2Flogger.js) ![NPM License](https://img.shields.io/npm/l/%40tklein1801%2Flogger.js) ![NPM Last Update](https://img.shie","directories":{},"_nodeVersion":"20.19.5","dependencies":{"util":"^0.12.5"},"_hasShrinkwrap":false,"devDependencies":{"rimraf":"^6.0.1","vitest":"^3.0.9","@vitest/ui":"^3.0.9","typescript":"^5.7.3","@types/node":"^24.0.14","@biomejs/biome":"^2.3.0"},"_npmOperationalInternal":{"tmp":"tmp/logger_0.0.1_1762457577620_0.6480246304442734","host":"s3://npm-registry-packages-npm-production"}},"0.0.2":{"name":"@budgetbuddyde/logger","version":"0.0.2","keywords":["logger.js","logging","utility"],"author":{"name":"Thorben Klein"},"license":"MIT","_id":"@budgetbuddyde/logger@0.0.2","maintainers":[{"name":"tklein1801","email":"thorb.klein1801@gmail.com"}],"homepage":"https://github.com/budgetbuddyde/logger","bugs":{"url":"https://github.com/budgetbuddyde/logger/issues"},"dist":{"shasum":"7c6c45c436d45a8b4f2e669ca1d7db1b5091a126","tarball":"https://registry.npmjs.org/@budgetbuddyde/logger/-/logger-0.0.2.tgz","fileCount":35,"integrity":"sha512-EV+SjrpJSXSBLLc5/YpJmnPviHa62glxON1R1HJacJiyHeNn2QIA8RfDgibzPXmr+i+an8eWQcvmGP495YoNHA==","signatures":[{"sig":"MEYCIQCiWkkmLXmv1QAVIq4U6d1eXAhO2Q+nYFeO/WfuX+fJpAIhALIHn/KiS7t+2QAPnWjMc2zia2T3N+YjtnO52ayurFAH","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":46127},"main":"lib/index.js","types":"lib/index.d.ts","gitHead":"c98a48df858ff47711993b560d148696f399ee9a","scripts":{"lint":"biome lint --write","test":"vitest run --silent","build":"rimraf lib && tsc","check":"biome check --error-on-warnings","format":"biome format --write","pretest":"npm run check","test:watch":"vitest"},"_npmUser":{"name":"tklein1801","email":"thorb.klein1801@gmail.com"},"repository":{"url":"git+https://github.com/budgetbuddyde/logger.git","type":"git"},"_npmVersion":"10.8.2","description":"![CI](https://ci.tools.tklein.it/api/v1/teams/main/pipelines/logger.js/badge) ![NPM Version](https://img.shields.io/npm/v/%40tklein1801%2Flogger.js) ![NPM License](https://img.shields.io/npm/l/%40tklein1801%2Flogger.js) ![NPM Last Update](https://img.shie","directories":{},"_nodeVersion":"20.19.5","dependencies":{"util":"^0.12.5"},"_hasShrinkwrap":false,"devDependencies":{"rimraf":"^6.0.1","vitest":"^3.0.9","@vitest/ui":"^3.0.9","typescript":"^5.7.3","@types/node":"^24.0.14","@biomejs/biome":"^2.3.0"},"_npmOperationalInternal":{"tmp":"tmp/logger_0.0.2_1762459161760_0.641071560886606","host":"s3://npm-registry-packages-npm-production"}},"0.1.0":{"name":"@budgetbuddyde/logger","version":"0.1.0","keywords":["logger.js","logging","utility"],"author":{"name":"Thorben Klein"},"license":"MIT","_id":"@budgetbuddyde/logger@0.1.0","maintainers":[{"name":"tklein1801","email":"thorb.klein1801@gmail.com"}],"homepage":"https://github.com/budgetbuddyde/logger","bugs":{"url":"https://github.com/budgetbuddyde/logger/issues"},"dist":{"shasum":"4b9e765261ca9c4da9ea164e471c02432bf7862a","tarball":"https://registry.npmjs.org/@budgetbuddyde/logger/-/logger-0.1.0.tgz","fileCount":19,"integrity":"sha512-rrk5pAuLvtN/5LQ/Iz4ZPuFsXZuNGNdBY7jKYncdS9qSerg2v4geRg2oR5L52/gZYgEDu2YQrPQaaN3j/zpKqA==","signatures":[{"sig":"MEQCIGaWUxWvSDoIMBwRmhx5lwbbLBuD+sH8vq4L0nJ6ntloAiBZDg1RXwsS4B+JI0HQrB5y5wjqybLTH9q54JCaV6P0EQ==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":14056},"main":"lib/index.js","types":"lib/index.d.ts","exports":{".":{"types":"./lib/index.d.ts","default":"./lib/index.js","dev-source":"./src/index.ts"},"./utils":{"types":"./lib/utils.d.ts","default":"./lib/utils.js","dev-source":"./src/utils.ts"}},"gitHead":"ee843d926e9d5ba110c74a965fbe49c2c25cf5c6","scripts":{"lint":"biome lint --write","test":"vitest run --silent","build":"rimraf lib && tsc","check":"biome check --error-on-warnings","format":"biome format --write","pretest":"npm run check","test:watch":"vitest","check:write":"npm run check -- --write --unsafe"},"_npmUser":{"name":"tklein1801","email":"thorb.klein1801@gmail.com"},"repository":{"url":"git+https://github.com/budgetbuddyde/logger.git","type":"git"},"_npmVersion":"10.9.4","description":"![CI](https://ci.tklein.it/api/v1/teams/budgetbuddyde/pipelines/logger/jobs/build-logger/badge) ![NPM Version](https://img.shields.io/npm/v/%40budgetbuddyde%2Flogger) ![NPM License](https://img.shields.io/npm/l/%40budgetbuddyde%2Flogger) ![NPM Last Update","directories":{},"_nodeVersion":"22.21.1","typesVersions":{"*":{"*":["./lib/index.d.js"],"utils":["./lib/utils.d.js"]}},"_hasShrinkwrap":false,"devDependencies":{"rimraf":"^6.0.1","vitest":"^3.0.9","@vitest/ui":"^3.0.9","typescript":"^5.7.3","@types/node":"^24.0.14","@biomejs/biome":"^2.3.0"},"peerDependencies":{"winston":"^3.19.0"},"_npmOperationalInternal":{"tmp":"tmp/logger_0.1.0_1767281216001_0.16162368239300573","host":"s3://npm-registry-packages-npm-production"}},"0.1.1":{"name":"@budgetbuddyde/logger","version":"0.1.1","description":"![CI](https://ci.tklein.it/api/v1/teams/budgetbuddyde/pipelines/logger/jobs/build-logger/badge) ![NPM Version](https://img.shields.io/npm/v/%40budgetbuddyde%2Flogger) ![NPM License](https://img.shields.io/npm/l/%40budgetbuddyde%2Flogger) ![NPM Last Update","keywords":["logger.js","logging","utility"],"author":{"name":"Thorben Klein"},"license":"MIT","homepage":"https://github.com/budgetbuddyde/logger","repository":{"type":"git","url":"git+https://github.com/budgetbuddyde/logger.git"},"bugs":{"url":"https://github.com/budgetbuddyde/logger/issues"},"scripts":{"build":"rimraf lib && tsc","pretest":"npm run check","test":"vitest run --silent","test:watch":"vitest","check":"biome check --error-on-warnings","check:write":"npm run check -- --write --unsafe","lint":"biome lint --write","format":"biome format --write"},"devDependencies":{"@biomejs/biome":"^2.3.0","@types/node":"^24.0.14","@vitest/ui":"^3.0.9","rimraf":"^6.0.1","typescript":"^5.7.3","vitest":"^3.0.9"},"peerDependencies":{"winston":"^3.19.0"},"main":"lib/index.js","types":"lib/index.d.ts","exports":{".":{"dev-source":"./src/index.ts","types":"./lib/index.d.ts","default":"./lib/index.js"},"./utils":{"dev-source":"./src/utils.ts","types":"./lib/utils.d.ts","default":"./lib/utils.js"}},"typesVersions":{"*":{"*":["./lib/index.d.js"],"utils":["./lib/utils.d.js"]}},"_id":"@budgetbuddyde/logger@0.1.1","gitHead":"9191eebbcc2a6adb9e4578667328aff9d3f3816e","_nodeVersion":"22.21.1","_npmVersion":"10.9.4","dist":{"integrity":"sha512-sVk+yuKew2Ebxhnss+x9KWYjZa8QEpkoJwiZZlMmmpgK8PWzJdfv7GNpvdWKfjB7LmompJ7+98PcyZ9nZDo3hg==","shasum":"8208c03952fff9e8e2d248d725e204c22df71270","tarball":"https://registry.npmjs.org/@budgetbuddyde/logger/-/logger-0.1.1.tgz","fileCount":19,"unpackedSize":14009,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQCGGpYI/o1x6Pjp7abKGJdFkjeYRo+PA5BTvb63r7cNxgIgXvRWyYazsdYl3T+IgOpE3NtSbWA5jBSfGMVqU9IH9G8="}]},"_npmUser":{"name":"tklein1801","email":"thorb.klein1801@gmail.com"},"directories":{},"maintainers":[{"name":"tklein1801","email":"thorb.klein1801@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/logger_0.1.1_1767283888088_0.3957350804318176"},"_hasShrinkwrap":false}},"time":{"created":"2025-11-06T19:32:57.559Z","modified":"2026-01-01T16:11:28.523Z","0.0.1":"2025-11-06T19:32:57.884Z","0.0.2":"2025-11-06T19:59:21.944Z","0.1.0":"2026-01-01T15:26:56.296Z","0.1.1":"2026-01-01T16:11:28.240Z"},"bugs":{"url":"https://github.com/budgetbuddyde/logger/issues"},"author":{"name":"Thorben Klein"},"license":"MIT","homepage":"https://github.com/budgetbuddyde/logger","keywords":["logger.js","logging","utility"],"repository":{"type":"git","url":"git+https://github.com/budgetbuddyde/logger.git"},"description":"![CI](https://ci.tklein.it/api/v1/teams/budgetbuddyde/pipelines/logger/jobs/build-logger/badge) ![NPM Version](https://img.shields.io/npm/v/%40budgetbuddyde%2Flogger) ![NPM License](https://img.shields.io/npm/l/%40budgetbuddyde%2Flogger) ![NPM Last Update","maintainers":[{"name":"tklein1801","email":"thorb.klein1801@gmail.com"}],"readme":"# `@budgetbuddyde/logger`\n\n![CI](https://ci.tklein.it/api/v1/teams/budgetbuddyde/pipelines/logger/jobs/build-logger/badge)\n![NPM Version](https://img.shields.io/npm/v/%40budgetbuddyde%2Flogger)\n![NPM License](https://img.shields.io/npm/l/%40budgetbuddyde%2Flogger)\n![NPM Last Update](https://img.shields.io/npm/last-update/%40budgetbuddyde%2Flogger)\n\nA collection of utility functions, configurations, and formatters for Winston loggers used within the BudgetBuddy project.\n\n## Features\n\n- **Log Level Utilities**: Helper functions for parsing and validating log levels from environment variables\n- **Console Format Builder**: Pre-configured Winston formatters for consistent console output\n- **Level Padding**: Formatting for uniform level output in logs\n- **Level Configuration**: Standardized log level configuration with colors for the entire project\n- **TypeScript Support**: Fully typed with comprehensive type definitions\n- **Winston Integration**: Seamless integration with Winston for all services and apps\n\n## Installation\n\n```bash\nnpm install @budgetbuddyde/logger\n```\n\n## Quick Start\n\n### Log Level from Environment Variables\n\n```typescript\nimport { getLogLevel } from '@budgetbuddyde/logger';\n\nconst logLevel = getLogLevel(process.env.LOG_LEVEL); // 'info', 'debug', 'warn', etc.\n```\n\n### Winston Logger with Custom Format\n\n```typescript\nimport { createLogger, format } from 'winston';\nimport { buildConsoleFormat, padLevel, LevelConfig } from '@budgetbuddyde/logger';\n\nexport const logger = createLogger({\n  levels: LevelConfig.levels,\n  level: getLogLevel(process.env.LOG_LEVEL),\n  format: format.combine(\n    format.timestamp({ format: 'YYYY-MM-DD HH:mm:ss' }),\n    format.splat(),\n    padLevel(5), // Pads level to 5 characters\n    format.colorize({ level: true, colors: LevelConfig.colors }),\n    buildConsoleFormat('MyService', false) // Show service name and meta\n  ),\n  transports: [new transports.Console()],\n});\n\nlogger.info('Application started');\nlogger.warn('This is a warning');\nlogger.error('An error occurred');\n```\n\n## Usage in the Project\n\nThe logger package is used across all services (Backend, Auth-Service) and apps (WebApp) in the BudgetBuddy project to ensure consistent logging configuration and formatting.\n\n### In the Backend Service\n\n```typescript\nimport { createLogger, format } from 'winston';\nimport { buildConsoleFormat, padLevel, LevelConfig } from '@budgetbuddyde/logger';\n\nexport const logger = createLogger({\n  levels: LevelConfig.levels,\n  level: config.log.level,\n  format: format.combine(\n    format.timestamp({ format: 'YYYY-MM-DD HH:mm:ss' }),\n    format.splat(),\n    padLevel(5),\n    format.colorize({ level: true, colors: LevelConfig.colors }),\n    buildConsoleFormat(config.service, config.log.hideMeta)\n  ),\n  transports: config.log.transports,\n});\n```\n\n### In the WebApp\n\nFor the WebApp, a simplified version using direct `createLogger` from the package is used (if available), or Winston is configured directly.\n\n## API Reference\n\n### Log Levels\n\n```typescript\nenum ELogLevel {\n  SILENT = 'silent',\n  DEBUG = 'debug',\n  INFO = 'info',\n  WARN = 'warn',\n  ERROR = 'error',\n  CRIT = 'crit',\n}\n\ntype LogLevel = keyof typeof LevelConfig.levels;\n```\n\n### Level Configuration\n\n```typescript\nconst LevelConfig = {\n  levels: {\n    silent: 6,\n    debug: 5,\n    info: 3,\n    warn: 2,\n    error: 1,\n    crit: 0,\n  },\n  colors: {\n    silent: 'gray',\n    debug: 'blue',\n    info: 'green',\n    warn: 'yellow',\n    error: 'red',\n    crit: 'magenta',\n  },\n};\n```\n\n### Utility Functions\n\n#### `getLogLevel(logLevel: string | undefined): LogLevel`\n\nParses a log level from a string (e.g., environment variable) and returns a valid `LogLevel`.\n\n```typescript\nconst level = getLogLevel(process.env.LOG_LEVEL); // 'info' as fallback\n```\n\n#### `buildConsoleFormat(fallbackLabel: string, hideMeta?: boolean)`\n\nCreates a Winston format for console output with timestamp, level, label, and optional metadata.\n\n#### `padLevel(whitespaceCount: number)`\n\nA Winston format transformer that pads log levels to a uniform length and converts them to uppercase.\n\n## Development\n\n```bash\n# Install dependencies\nnpm install\n\n# Run tests\nnpm test\n\n# Build package\nnpm run build\n\n# Lint and format\nnpm run check\n```\n\n## Dependencies\n\n- **Winston**: The package is designed as a peer dependency for Winston (^3.19.0) and provides utility functions for Winston loggers.\n","readmeFilename":"README.md"}