{"_id":"@loggerhub/core","_rev":"5-5686274c8559babcb8c3519a259a3178","name":"@loggerhub/core","dist-tags":{"latest":"1.0.5"},"versions":{"1.0.0":{"name":"@loggerhub/core","version":"1.0.0","keywords":["logger","logging","typescript","adapter","factory"],"author":{"name":"OneTeamSoftware"},"license":"MIT","_id":"@loggerhub/core@1.0.0","maintainers":[{"name":"dmitryrechkin","email":"rechkin@gmail.com"}],"dist":{"shasum":"453c192c022b7fceaaff349c3720852b6bcad578","tarball":"https://registry.npmjs.org/@loggerhub/core/-/core-1.0.0.tgz","fileCount":53,"integrity":"sha512-STqnf6iukKuQbFj9mXbHv5DhVHyV6Wj18qr7U7zyvqYki6gj4VYbQNvL6mZe1E130teZdnZUALdXVp9UowZRDg==","signatures":[{"sig":"MEQCIBz8j6XUnNXsDiJoFO5+mq5WBjz6Jyo3oVZxo55rsJ3JAiAZ93FO8w1xtc77WP593gx+WDQRo/soXPiaUWQ59aa9jg==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":56111},"main":"dist/index.js","types":"dist/index.d.ts","engines":{"node":">=18.0.0"},"gitHead":"7081226268d1c2e7afee96c6e672c555247ae4e4","scripts":{"lint":"eslint .","test":"vitest","build":"tsc","clean":"rimraf dist","format":"eslint --fix .","package:tgz":"npm pack","test:coverage":"vitest --coverage","prepublishOnly":"npm run clean && npm run build","package:publish":"npm publish --access public"},"_npmUser":{"name":"dmitryrechkin","email":"rechkin@gmail.com"},"_npmVersion":"11.4.2","description":"Core logger interfaces and built-in adapters for LoggerHub","directories":{},"_nodeVersion":"23.11.0","_hasShrinkwrap":false,"devDependencies":{"rimraf":"^5.0.10","vitest":"^1.6.1","typescript":"^5.8.3","@types/node":"^20.19.9","@vitest/coverage-v8":"^1.6.1","@dmitryrechkin/eslint-standard":"^1.1.4"},"_npmOperationalInternal":{"tmp":"tmp/core_1.0.0_1753582786048_0.04905953564860521","host":"s3://npm-registry-packages-npm-production"}},"1.0.1":{"name":"@loggerhub/core","version":"1.0.1","keywords":["logger","logging","typescript","adapter","factory"],"author":{"name":"OneTeamSoftware"},"license":"MIT","_id":"@loggerhub/core@1.0.1","maintainers":[{"name":"dmitryrechkin","email":"rechkin@gmail.com"}],"dist":{"shasum":"cfb84bd3e4eef1abf68dfba37a9eab2a34d63187","tarball":"https://registry.npmjs.org/@loggerhub/core/-/core-1.0.1.tgz","fileCount":53,"integrity":"sha512-qeEw7r/WOnc9xSquYaXaugbOJNhZRYizW79UpQQ7lIxdQkHr3j+pOtj4w2Q4g7tGarpUZuty7ZZQTG9FZ5v/6w==","signatures":[{"sig":"MEQCIDa7OmiboVIsqpbGZNZ/B8OEsOzN0/WJ6Nr3Me5iAC8kAiBu/ExcrP5wdxhBk3vL4jadSl8U1MSRj+lVUtleUsFFjQ==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":59237},"main":"dist/index.js","type":"module","types":"dist/index.d.ts","engines":{"node":">=18.0.0"},"gitHead":"e7ffd3bb14117cdcb04571aaeca51eadaa543817","scripts":{"lint":"eslint .","test":"vitest run","build":"tsc","clean":"rimraf dist","format":"eslint --fix .","package:tgz":"npm pack","test:coverage":"vitest run --coverage","prepublishOnly":"npm run clean && npm run build","package:publish":"npm publish --access public"},"_npmUser":{"name":"dmitryrechkin","email":"rechkin@gmail.com"},"_npmVersion":"11.4.2","description":"Core logger interfaces and built-in adapters for LoggerHub","directories":{},"_nodeVersion":"23.11.0","dependencies":{"dotenv":"^17.2.1"},"_hasShrinkwrap":false,"devDependencies":{"rimraf":"^5.0.10","vitest":"^1.6.1","typescript":"^5.8.3","@types/node":"^20.19.9","@vitest/coverage-v8":"^1.6.1","@dmitryrechkin/eslint-standard":"^1.1.4"},"_npmOperationalInternal":{"tmp":"tmp/core_1.0.1_1753638165818_0.10135018085271441","host":"s3://npm-registry-packages-npm-production"}},"1.0.2":{"name":"@loggerhub/core","version":"1.0.2","keywords":["logger","logging","typescript","adapter","factory"],"author":{"name":"OneTeamSoftware"},"license":"MIT","_id":"@loggerhub/core@1.0.2","maintainers":[{"name":"dmitryrechkin","email":"rechkin@gmail.com"}],"dist":{"shasum":"412dc4c8ce0a2efaab8477d4f94a03b713d76185","tarball":"https://registry.npmjs.org/@loggerhub/core/-/core-1.0.2.tgz","fileCount":53,"integrity":"sha512-0H/3o7eFqaiw1lPmIC1nXAQqouuT2EmOckmLGcoH5XOfyrtLziAZfJbRDzfDL9Ry4QqbsHE1lZ4AaDaaaSQehw==","signatures":[{"sig":"MEQCIGMNUBFtSvqn1UxO3XVGefOsulrCNHaH6XhsIDBr48EVAiBWRNi7rSAi4K2xqMpmWoa0zElYAnMQa2WtHUk5U61vzg==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":59565},"main":"dist/index.js","type":"module","types":"dist/index.d.ts","engines":{"node":">=18.0.0"},"gitHead":"51076250f2d162f928c1dfd24bbf9e380c02c7e8","scripts":{"lint":"eslint .","test":"vitest run","build":"tsc","clean":"rimraf dist","format":"eslint --fix .","package:tgz":"npm pack","test:coverage":"vitest run --coverage","prepublishOnly":"npm run clean && npm run build","package:publish":"npm publish --access public"},"_npmUser":{"name":"dmitryrechkin","email":"rechkin@gmail.com"},"_npmVersion":"11.4.2","description":"Core logger interfaces and built-in adapters for LoggerHub","directories":{},"_nodeVersion":"23.11.0","dependencies":{"dotenv":"^17.2.1"},"_hasShrinkwrap":false,"devDependencies":{"rimraf":"^5.0.10","vitest":"^1.6.1","typescript":"^5.8.3","@types/node":"^20.19.9","@vitest/coverage-v8":"^1.6.1","@dmitryrechkin/eslint-standard":"^1.1.4"},"_npmOperationalInternal":{"tmp":"tmp/core_1.0.2_1754002508417_0.3678040133599869","host":"s3://npm-registry-packages-npm-production"}},"1.0.4":{"name":"@loggerhub/core","version":"1.0.4","keywords":["logger","logging","typescript","adapter","factory"],"author":{"name":"OneTeamSoftware"},"license":"MIT","_id":"@loggerhub/core@1.0.4","maintainers":[{"name":"dmitryrechkin","email":"rechkin@gmail.com"}],"dist":{"shasum":"78ae37ec7bc46c5bf0553a2066a4caafc3112e1c","tarball":"https://registry.npmjs.org/@loggerhub/core/-/core-1.0.4.tgz","fileCount":53,"integrity":"sha512-+CjSCnNzQvo8EQ2KIVyY6C7IJrS4N8wwlH+iHn4zC2VFcW0HwtZ0EQwoW1edIJyqbsblrFHitheAh7GkpdnWLA==","signatures":[{"sig":"MEUCIQCDykqEQOgHQaKEbh7NqrtitcRMsMimODn7AropAs1Z+AIgOqzVkDfel9ETvEOji4hSG9kqtwujmXusZD1S6QZKB50=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":60178},"main":"dist/index.js","type":"module","types":"dist/index.d.ts","engines":{"node":">=18.0.0"},"gitHead":"e20f4a8cb7771e951ce13417d58e4bb4a5894a88","scripts":{"lint":"eslint .","test":"vitest run","build":"tsc","clean":"rimraf dist","format":"eslint --fix .","package:tgz":"npm pack","test:coverage":"vitest run --coverage","prepublishOnly":"npm run clean && npm run build","package:publish":"npm publish --access public"},"_npmUser":{"name":"dmitryrechkin","email":"rechkin@gmail.com"},"_npmVersion":"11.4.2","description":"Core logger interfaces and built-in adapters for LoggerHub","directories":{},"_nodeVersion":"23.11.0","dependencies":{"dotenv":"^17.2.1"},"_hasShrinkwrap":false,"devDependencies":{"rimraf":"^5.0.10","vitest":"^1.6.1","typescript":"^5.8.3","@types/node":"^20.19.9","@vitest/coverage-v8":"^1.6.1","@dmitryrechkin/eslint-standard":"^1.1.4"},"_npmOperationalInternal":{"tmp":"tmp/core_1.0.4_1754156566920_0.661520274057082","host":"s3://npm-registry-packages-npm-production"}},"1.0.5":{"name":"@loggerhub/core","version":"1.0.5","description":"Core logger interfaces and built-in adapters for LoggerHub","type":"module","main":"dist/index.js","types":"dist/index.d.ts","scripts":{"build":"tsc && tsc-esm-fix --target=dist","test":"vitest run","test:coverage":"vitest run --coverage","clean":"rimraf dist","prepublishOnly":"npm run clean && npm run build","package:tgz":"npm pack","package:publish":"npm publish --access public","format":"eslint --fix .","lint":"eslint ."},"keywords":["logger","logging","typescript","adapter","factory"],"author":{"name":"OneTeamSoftware"},"license":"MIT","devDependencies":{"@dmitryrechkin/eslint-standard":"^1.1.4","@types/node":"^20.19.9","@vitest/coverage-v8":"^1.6.1","rimraf":"^5.0.10","tsc-esm-fix":"^3.0.2","typescript":"^5.8.3","vitest":"^1.6.1"},"engines":{"node":">=18.0.0"},"dependencies":{"dotenv":"^17.2.1"},"_id":"@loggerhub/core@1.0.5","gitHead":"afc6bfdb1a6fb44f76c847c0a7de6332545596e7","_nodeVersion":"23.11.0","_npmVersion":"11.4.2","dist":{"integrity":"sha512-nhUXOrTYkKN8yFv7BdAkTnyS7lfnPv3XrGHTgfz10gb2f7WUopWHOIRzspgF8QJeu3dTQ+7NR901BYOwmYA1wg==","shasum":"dfef4ba1ae6db308aee2ec9e2a38ed65b73c67a8","tarball":"https://registry.npmjs.org/@loggerhub/core/-/core-1.0.5.tgz","fileCount":53,"unpackedSize":60551,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQDufKrjMDPNu1/NV5xCdIsgb1s5gvWW7tS1y/nO7/dPngIhAK/ligUG6mScuVrZerptjKSZ1Les1M/d7bOLeVmi/jGq"}]},"_npmUser":{"name":"dmitryrechkin","email":"rechkin@gmail.com"},"directories":{},"maintainers":[{"name":"dmitryrechkin","email":"rechkin@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/core_1.0.5_1754164764611_0.051711031594879664"},"_hasShrinkwrap":false}},"time":{"created":"2025-07-27T02:19:45.941Z","modified":"2025-08-02T19:59:25.000Z","1.0.0":"2025-07-27T02:19:46.239Z","1.0.1":"2025-07-27T17:42:46.018Z","1.0.2":"2025-07-31T22:55:08.609Z","1.0.4":"2025-08-02T17:42:47.156Z","1.0.5":"2025-08-02T19:59:24.816Z"},"author":{"name":"OneTeamSoftware"},"license":"MIT","keywords":["logger","logging","typescript","adapter","factory"],"description":"Core logger interfaces and built-in adapters for LoggerHub","maintainers":[{"name":"dmitryrechkin","email":"rechkin@gmail.com"}],"readme":"# @loggerhub/core\n\nCore logging interfaces and abstract implementations for the LoggerHub TypeScript logging library.\n\n## Overview\n\nThis package provides the fundamental building blocks for creating consistent, extensible logging solutions:\n\n- **LoggerInterface**: Standard logging interface with async methods for all log levels\n- **AbstractLogger**: Sophisticated base class with argument parsing and printf-style interpolation\n- **Factory Pattern**: Pluggable logger factory system with auto-registration\n- **Type Safety**: Full TypeScript support with proper interfaces and enums\n\n## Key Components\n\n### LoggerInterface\n\nStandard interface defining async logging methods:\n\n```typescript\ninterface LoggerInterface {\n    debug(...args: unknown[]): Promise<void>;\n    info(...args: unknown[]): Promise<void>;\n    warning(...args: unknown[]): Promise<void>;\n    error(...args: unknown[]): Promise<void>;\n    critical(...args: unknown[]): Promise<void>;\n    log(level: string, ...args: unknown[]): Promise<void>;\n}\n```\n\n### AbstractLogger\n\nBase class providing sophisticated argument parsing and features:\n\n```typescript\nexport abstract class AbstractLogger implements LoggerInterface {\n    // Implement only this method in concrete classes\n    protected abstract logInternal(level: string, message: string, meta?: any): Promise<void>;\n}\n```\n\n**Features:**\n- **Log Level Filtering**: Automatic filtering based on configured level\n- **5 Argument Patterns**: Flexible logging argument parsing\n- **Printf Interpolation**: Support for %s, %d, %j, %o, %% placeholders\n- **Structured Logging**: Object-based metadata support\n- **Type Safety**: Full TypeScript support\n\n### Argument Patterns\n\nThe AbstractLogger supports 5 flexible argument patterns:\n\n```typescript\n// Pattern 1: Single string message\nlogger.debug('Simple message');\n\n// Pattern 2: Object-only structured logging\nlogger.debug({ userId: 123, action: 'login' });\n\n// Pattern 3: Object + message\nlogger.debug({ userId: 123 }, 'Login failed');\n\n// Pattern 4: Message + object metadata\nlogger.debug('Login failed', { userId: 123 });\n\n// Pattern 5: Message + interpolation values\nlogger.debug('User %s failed login %d times', 'john', 3);\n```\n\n### Printf-Style Interpolation\n\nSupport for common printf placeholders:\n\n```typescript\nlogger.info('User %s has %d items', 'john', 5);        // %s = string\nlogger.info('Processing %d/%d items', 1, 10);          // %d = number  \nlogger.info('Config: %j', { debug: true });            // %j = JSON\nlogger.info('Object: %o', someObject);                 // %o = object\nlogger.info('Literal %% symbol');                      // %% = literal %\n```\n\n### Factory System\n\nPluggable factory pattern with auto-registration:\n\n```typescript\n// Register a factory\nLoggerFactoryRegistry.registerLoggerFactory('mylogger', MyLoggerFactory);\n\n// Create logger instances\nconst factory = new LoggerFactory();\nconst logger = factory.createLogger({\n    LOGGER_ADAPTER: 'mylogger',\n    LOGGER_LEVEL: EnumLogLevel.Info\n});\n```\n\n### Built-in Implementations\n\n**ConsoleLogger**: Basic console output\n```typescript\nconst factory = new LoggerFactory();\nconst logger = factory.createLogger({ LOGGER_ADAPTER: 'console', LOGGER_LEVEL: EnumLogLevel.Debug });\n```\n\n**NullLogger**: No-op logger for testing/disabled logging\n```typescript\nconst factory = new LoggerFactory();\nconst logger = factory.createLogger({ LOGGER_ADAPTER: 'null' });\n```\n\n## Log Levels\n\n```typescript\nenum EnumLogLevel {\n    Debug = 'debug',\n    Info = 'info', \n    Warning = 'warning',\n    Error = 'error',\n    Critical = 'critical'\n}\n```\n\nLog level hierarchy (lower levels include higher levels):\n- `debug`: All messages\n- `info`: Info, warning, error, critical\n- `warning`: Warning, error, critical  \n- `error`: Error, critical\n- `critical`: Critical only\n\n## Creating Custom Loggers\n\n### Extending AbstractLogger\n\n```typescript\nimport { AbstractLogger } from '@loggerhub/core';\n\nexport class MyLogger extends AbstractLogger {\n    protected async logInternal(level: string, message: string, meta?: any): Promise<void> {\n        // Your logging implementation\n        console.log(`[${level.toUpperCase()}] ${message}`, meta || '');\n    }\n}\n```\n\n### Creating a Factory\n\n```typescript\nimport { LoggerFactoryInterface, TypeLoggerConfig } from '@loggerhub/core';\n\nexport class MyLoggerFactory implements LoggerFactoryInterface {\n    createLogger(config: TypeLoggerConfig): LoggerInterface {\n        return new MyLogger(config);\n    }\n}\n```\n\n### Auto-Registration\n\n```typescript\nimport { LoggerFactoryRegistry } from '@loggerhub/core';\nimport { MyLoggerFactory } from './MyLoggerFactory';\n\n// Register your factory\nLoggerFactoryRegistry.registerLoggerFactory('mylogger', MyLoggerFactory);\n```\n\n## Configuration\n\n```typescript\ninterface TypeLoggerConfig {\n    LOGGER_ADAPTER?: string;    // Logger adapter type (default: 'console')\n    LOGGER_LEVEL?: EnumLogLevel; // Log level (default: 'info') \n    [key: string]: unknown;     // Additional adapter-specific config\n}\n```\n\n### Environment Variables\n\nThe logger can be configured using environment variables:\n\n- `LOGGER_ADAPTER` - Logger adapter type (default: `console`)\n  - Available values: `console`, `null`, `winston` (if winston adapter is installed)\n- `LOGGER_LEVEL` - Log level (default: `info`)\n  - Available values: `debug`, `info`, `warning`, `error`, `critical`\n\nExample `.env` file:\n```env\n# Logger Configuration\nLOGGER_ADAPTER=console\nLOGGER_LEVEL=info\n```\n\n### Usage with Environment Variables\n\n```typescript\nimport { LoggerFactory } from '@loggerhub/core';\n\n// Create logger using environment configuration\nconst factory = new LoggerFactory();\nconst logger = factory.createLogger();\n\n// Override environment configuration if needed\nconst customLogger = factory.createLogger({\n  LOGGER_ADAPTER: 'console',  // Overrides env LOGGER_ADAPTER\n  LOGGER_LEVEL: EnumLogLevel.Debug  // Overrides env LOGGER_LEVEL\n});\n```\n\n## Architecture Benefits\n\n- **Consistency**: All loggers follow the same interface\n- **Flexibility**: Multiple argument patterns for different use cases\n- **Performance**: Log level filtering prevents unnecessary processing\n- **Extensibility**: Easy to add new logger implementations\n- **Type Safety**: Full TypeScript support with proper types\n- **Testing**: Built-in null logger and registry reset for tests\n\n## Installation\n\n```bash\nnpm install @loggerhub/core\n```\n\n## License\n\nMIT","readmeFilename":"README.md"}