{"_id":"@dolgikh-maks/logger","_rev":"6-0351cb1864c58674027c82d6985f2e94","name":"@dolgikh-maks/logger","dist-tags":{"latest":"2.0.0"},"versions":{"1.0.1":{"name":"@dolgikh-maks/logger","version":"1.0.1","keywords":["console","debug","nodejs","console.log","browser log"],"author":{"url":"https://www.linkedin.com/in/max-dolgikh/","name":"Maks Dolgikh"},"license":"MIT","_id":"@dolgikh-maks/logger@1.0.1","maintainers":[{"name":"misterion96","email":"dolgih.m1996@gmail.com"}],"homepage":"https://github.com/Misterion96/logger#readme","bugs":{"url":"https://github.com/Misterion96/logger/issues"},"dist":{"shasum":"0f1e8563b5882b704ee88b3da0bd796ec549610f","tarball":"https://registry.npmjs.org/@dolgikh-maks/logger/-/logger-1.0.1.tgz","fileCount":5,"integrity":"sha512-xfz3lL+R/2q5DziQCmvXpVPLPgS3RDQZlAMZ+102HZPlYd94COUsIOcMBgK+lCGGmVxBmusiy/7pKv1c6OFLsA==","signatures":[{"sig":"MEYCIQDsPL+4oMuAm5fTDjCOQ23B67uYUtsXXltkXcxhz7IV4gIhAPLv8xUwtdTSlRV3kbjJ97XSnao50jDyGWGquKPTf34F","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":10204},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","gitHead":"3195edf7c0fcca82ef30b8dd4d2c010c2196ce72","private":false,"scripts":{"test":"vitest --run","build":"tsc --p ./tsconfig.lib.json"},"_npmUser":{"name":"misterion96","email":"dolgih.m1996@gmail.com"},"repository":{"url":"git+https://github.com/Misterion96/logger.git"},"_npmVersion":"10.8.2","description":"A simple, cross-platform logger with support for debug, info, warning, success, error messages, and Promise loading indicators. Works in both Node.js and browser environments.","directories":{},"_nodeVersion":"20.19.4","_hasShrinkwrap":false,"devDependencies":{"vitest":"4.0.2","ts-node":"10.9.2","typescript":"5.8.3","@types/node":"22.13.14","@dolgikh-maks/tsconfig":"1.0.0"},"_npmOperationalInternal":{"tmp":"tmp/logger_1.0.1_1761322200278_0.2517153926918152","host":"s3://npm-registry-packages-npm-production"}},"1.0.2":{"name":"@dolgikh-maks/logger","version":"1.0.2","keywords":["console","debug","nodejs","console.log","browser log"],"author":{"url":"https://www.linkedin.com/in/max-dolgikh/","name":"Maks Dolgikh"},"license":"MIT","_id":"@dolgikh-maks/logger@1.0.2","maintainers":[{"name":"misterion96","email":"dolgih.m1996@gmail.com"}],"homepage":"https://github.com/Misterion96/logger#readme","bugs":{"url":"https://github.com/Misterion96/logger/issues"},"dist":{"shasum":"cf28ece3b96a3053b84a5153f40ce0cd193a9723","tarball":"https://registry.npmjs.org/@dolgikh-maks/logger/-/logger-1.0.2.tgz","fileCount":5,"integrity":"sha512-GkcB/dPz7yEal+xKDqS+TK83DC7GpMoUa7SKci1yijlJsC6IfzLxC7UMm637UUPyhsrtLJO1QOxIBwHVqxbz4A==","signatures":[{"sig":"MEQCIHA1TwYYv5qnW3ySjJHt0SGM+jirqAdfEW9WXWH6jHj5AiAIqkjgJlWrIdRkRgrrc5M+K8fc6eDJWc9+Y0yLTDKrkQ==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":11417},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","gitHead":"d15105b713b2265a95a826aab1648571a2df49e8","private":false,"scripts":{"test":"vitest --run","build":"tsc --p ./tsconfig.lib.json"},"_npmUser":{"name":"misterion96","email":"dolgih.m1996@gmail.com"},"repository":{"url":"git+https://github.com/Misterion96/logger.git","type":"git"},"_npmVersion":"10.8.2","description":"A simple, cross-platform logger with support for debug, info, warning, success, error messages, and Promise loading indicators. Works in both Node.js and browser environments","directories":{},"_nodeVersion":"20.19.4","_hasShrinkwrap":false,"devDependencies":{"eslint":"9.38.0","vitest":"4.0.2","ts-node":"10.9.2","typescript":"5.8.3","@types/node":"22.13.14","@dolgikh-maks/tsconfig":"1.0.0","@dolgikh-maks/eslint-config":"1.0.1"},"_npmOperationalInternal":{"tmp":"tmp/logger_1.0.2_1761602329196_0.7724202212933866","host":"s3://npm-registry-packages-npm-production"}},"2.0.0":{"name":"@dolgikh-maks/logger","version":"2.0.0","private":false,"description":"A simple, cross-platform logger with support for debug, info, warning, success, error messages, and Promise loading indicators. Works in both Node.js and browser environments","keywords":["console","debug","nodejs","console.log","browser log"],"repository":{"url":"git+https://github.com/Misterion96/logger.git","type":"git"},"license":"MIT","author":{"name":"Maks Dolgikh","url":"https://www.linkedin.com/in/max-dolgikh/"},"type":"module","main":"./dist/index.js","types":"./dist/index.d.ts","scripts":{"test":"vitest --run","build":"tsc --p ./tsconfig.lib.json"},"devDependencies":{"@dolgikh-maks/eslint-config":"1.0.1","@dolgikh-maks/tsconfig":"1.0.0","@types/node":"22.13.14","eslint":"9.38.0","ts-node":"10.9.2","typescript":"5.8.3","vitest":"4.0.2"},"gitHead":"037c81d1737f1eace6d72c3b7d35f8321129595e","_id":"@dolgikh-maks/logger@2.0.0","bugs":{"url":"https://github.com/Misterion96/logger/issues"},"homepage":"https://github.com/Misterion96/logger#readme","_nodeVersion":"25.8.0","_npmVersion":"11.11.0","dist":{"integrity":"sha512-G5aaLeD9S3zr2jcPrq6oSPLR1AFanrTtiNUTN/YltZ1dUmXvn4MCpQBte4QzTNSXXQG7xCjIf9YnL8JbtqvslQ==","shasum":"8892e08dc450d9923527a8f8cd8f9ed139147356","tarball":"https://registry.npmjs.org/@dolgikh-maks/logger/-/logger-2.0.0.tgz","fileCount":17,"unpackedSize":21069,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQDtbPX8J/nYQD4/UFmJiYXgMvB0hm4Bif1JXmWVIf7HxAIgfp4rsaIYfZvJ850Srw3YGbVzqEVRbOgLX/sS9RFfnNE="}]},"_npmUser":{"name":"misterion96","email":"dolgih.m1996@gmail.com"},"directories":{},"maintainers":[{"name":"misterion96","email":"dolgih.m1996@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/logger_2.0.0_1774612941253_0.31032359031705514"},"_hasShrinkwrap":false}},"time":{"created":"2025-10-24T16:10:00.171Z","modified":"2026-03-27T12:02:21.950Z","1.0.0":"2025-10-24T16:02:15.223Z","1.0.1":"2025-10-24T16:10:00.459Z","1.0.2":"2025-10-27T21:58:49.377Z","2.0.0":"2026-03-27T12:02:21.403Z"},"bugs":{"url":"https://github.com/Misterion96/logger/issues"},"author":{"name":"Maks Dolgikh","url":"https://www.linkedin.com/in/max-dolgikh/"},"license":"MIT","homepage":"https://github.com/Misterion96/logger#readme","keywords":["console","debug","nodejs","console.log","browser log"],"repository":{"url":"git+https://github.com/Misterion96/logger.git","type":"git"},"description":"A simple, cross-platform logger with support for debug, info, warning, success, error messages, and Promise loading indicators. Works in both Node.js and browser environments","maintainers":[{"name":"misterion96","email":"dolgih.m1996@gmail.com"}],"readme":"# Logger 🐳\n\nA simple, cross-platform logger with support for debug, info, warning, success, error messages, and Promise loading indicators. Works in both Node.js and browser environments.\n\n---\n\n## Installation\n\n```bash\n# Using npm\nnpm install @dolgikh-maks/logger\n\n# Using yarn\nyarn add @dolgikh-maks/logger\n```\n\n---\n\n## Quick Start\n\nThe simplest way to start is using the default `createLogger` function.\n\n```ts\nimport createLogger from '@dolgikh-maks/logger';\n\nconst logger = createLogger({ scope: 'MyApp' });\n\nlogger.info('Application started');\nlogger.success('Operation completed');\n```\n\n---\n\n## Core Principles\nWhen creating `@dolgikh-maks/logger`, I was guided by these principles:\n- **Minimalism**: No configurations longer than 100 lines.\n- **Context Isolation**: Each module has its own scope to avoid confusion.\n- **Predictability**: Consistent behavior across Browser and Node.js.\n- **Zero-overhead**: Debug logs have zero impact when disabled.\n\n---\n\n## Methods\n\n### `info(message: string, ...args: any[])`\nLogs an informative message (prefix 🔵).\n```ts\nlogger.info('Starting server...');\n```\n\n### `success(message: string, ...args: any[])`\nLogs a success message (prefix 🟢).\n```ts\nlogger.success('User authenticated');\n```\n\n### `warn(message: string, ...args: any[])`\nLogs a warning message (prefix 🟡).\n```ts\nlogger.warn('Rate limit approaching');\n```\n\n### `error(message: string, ...args: any[])`\nLogs an error message (prefix 🔴).\n```ts\nlogger.error('Database connection failed', error);\n```\n\n### `debug(message: string, ...args: any[])`\nLogs a debug message (prefix ⚪) **only if debugging is enabled**.\n```ts\nlogger.debug('Internal state:', state);\n```\n\n### `setDebug(enabled: boolean)`\nEnables or disables debug messages globally for the factory.\n```ts\nlogger.setDebug(true);\n```\n\n### `loading<T>(comment: string, promise: Promise<T>): Promise<T>`\nShows a loading indicator while a Promise is pending. \n- **Browser**: Shows execution time in ms.\n- **Node.js**: Displays an animated spinner in TTY environments.\n\n```ts\nconst data = await logger.loading('Fetching data', api.getUsers());\n```\n\n---\n\n## Advanced Usage\n\n### LoggerFactory\nFor complex applications, use `LoggerFactory` to centralize configuration.\n\n```ts\nimport { LoggerFactory, ConsoleTransport } from '@dolgikh-maks/logger';\n\nconst factory = new LoggerFactory({\n  level: 'info',\n  useTimestamps: true,\n  transports: [\n    new ConsoleTransport({\n      methods: {\n        info: 'table', // Use console.table for info logs\n      }\n    })\n  ]\n});\n\nconst logger = factory.createLogger({ scope: 'Database' });\n```\n\n### Custom Transports\nImplement the `Transport` interface to direct logs to external services (e.g., Sentry, File).\n\n```ts\nimport type { Transport, LogEntry } from '@dolgikh-maks/logger';\n\nclass MyTransport implements Transport {\n  send(entry: LogEntry) {\n    // entry.level, entry.scope, entry.message, entry.additionalData\n  }\n}\n```\n\n---\n\n## Documentation\nFor more detailed information, check the `.docs` directory:\n- [Architecture & Principles](.docs/index.md)\n- [Full API Reference](.docs/api.md)\n- [Recipes & Best Practices](.docs/recipes.md)\n","readmeFilename":"README.md"}