{"_id":"@asenajs/asena-logger","_rev":"3-acc4bf32b03c18c6e1cc0ea78b648c46","name":"@asenajs/asena-logger","dist-tags":{"latest":"3.0.0"},"versions":{"1.0.0":{"name":"@asenajs/asena-logger","version":"1.0.0","author":{"name":"LibirSoft"},"license":"MIT","_id":"@asenajs/asena-logger@1.0.0","maintainers":[{"name":"libir","email":"libirsoft@gmail.com"}],"homepage":"https://github.com/AsenaJs/asena-logger#readme","bugs":{"url":"https://github.com/AsenaJs/asena-logger/issues"},"dist":{"shasum":"4cf76fdd29eee06b5f02fa3bf911a74fca9fa124","tarball":"https://registry.npmjs.org/@asenajs/asena-logger/-/asena-logger-1.0.0.tgz","fileCount":9,"integrity":"sha512-dfliw13PqC4mHNEqDxPOkjZWUu8O5r6cv2/E1WkJSeQq3NiGe0NL0LJaHH45Mzm0RgUySYw2oWVn2YG7a/oJJw==","signatures":[{"sig":"MEUCIDusE9AntmSRdyn5aRqIru6scJl+1KNR+lCU/IjWmKUZAiEAstsdB+8rkJYz/gLKNIMUTmyXI3H83X0q75EMgHE+a64=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":15390},"main":"dist/index.js","types":"dist/index.d.ts","module":"index.ts","gitHead":"fc11acedbf3ba2f7426dfadc9ddda1f664c3de2f","scripts":{"test":"bun test","build":"bun run clean && tsc","clean":"rm -rf dist","test:watch":"bun test --watch","test:coverage":"bun test --coverage","prepublishOnly":"bun run build"},"_npmUser":{"name":"libir","email":"libirsoft@gmail.com"},"repository":{"url":"git+https://github.com/AsenaJs/asena-logger.git","type":"git"},"_npmVersion":"11.3.0","description":"Just a logger for AsenaJS","directories":{},"_nodeVersion":"23.9.0","dependencies":{"winston":"^3.17.0"},"_hasShrinkwrap":false,"devDependencies":{"eslint":"^8.57.1","prettier":"^3.5.3","@types/bun":"latest","@asenajs/asena":"^0.3.0","@changesets/cli":"^2.29.3","eslint-plugin-n":"^16.6.2","eslint-config-alloy":"^5.1.2","eslint-plugin-alloy":"^1.2.1","eslint-plugin-import":"^2.31.0","eslint-plugin-promise":"^6.6.0","eslint-config-prettier":"^9.1.0","eslint-plugin-prettier":"^5.4.0","@typescript-eslint/eslint-plugin":"^6.21.0"},"peerDependencies":{"typescript":"^5.8.2"},"_npmOperationalInternal":{"tmp":"tmp/asena-logger_1.0.0_1746657014943_0.7926055309663576","host":"s3://npm-registry-packages-npm-production"}},"2.0.0":{"name":"@asenajs/asena-logger","version":"2.0.0","author":{"name":"LibirSoft"},"license":"MIT","_id":"@asenajs/asena-logger@2.0.0","maintainers":[{"name":"libir","email":"libirsoft@gmail.com"}],"homepage":"https://github.com/AsenaJs/asena-logger#readme","bugs":{"url":"https://github.com/AsenaJs/asena-logger/issues"},"dist":{"shasum":"014afc71baba9ce35f005b6332763a204c5ecc2f","tarball":"https://registry.npmjs.org/@asenajs/asena-logger/-/asena-logger-2.0.0.tgz","fileCount":9,"integrity":"sha512-ikPFD6I0xhufiaM5O41gtrcZm/aNrUom0HJ5Kjh82SKzEEaN67Ss8NABYQRje+VOd7ZUPhyZmwoNu3Etu/+/bw==","signatures":[{"sig":"MEQCIGyx1fyJlWDDpQD8LFO736st7yE4aR9MSn+LW4GJdJbWAiALzCY/YQcDIrxtJndACMWLunabdk5zVqbVZZhhP1ELmA==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":16227},"main":"dist/index.js","types":"dist/index.d.ts","module":"index.ts","engines":{"bun":">=1.3.12"},"gitHead":"d37fc880591ec3b0124beed9e416363fd85d3ab0","scripts":{"lint":"eslint . --ext .ts","test":"bun test","build":"bun run clean && tsc","check":"bun run lint && bun run format:check","clean":"rm -rf dist","format":"prettier --write .","release":"bun run build && changeset publish","version":"changeset version","lint:fix":"eslint . --ext .ts --fix","changeset":"changeset","check:fix":"bun run lint:fix && bun run format","typecheck":"tsc -p tsconfig.typecheck.json","test:watch":"bun test --watch","format:check":"prettier --check .","test:coverage":"bun test --coverage","prepublishOnly":"bun run build"},"_npmUser":{"name":"libir","email":"libirsoft@gmail.com"},"repository":{"url":"git+https://github.com/AsenaJs/asena-logger.git","type":"git"},"_npmVersion":"12.0.1","description":"Just a logger for AsenaJS","directories":{},"_nodeVersion":"26.5.0","dependencies":{"winston":"^3.19.0"},"_hasShrinkwrap":false,"devDependencies":{"eslint":"^8.57.1","prettier":"^3.8.1","@types/bun":"latest","@asenajs/asena":"^0.10.0","@changesets/cli":"^2.30.0","eslint-plugin-n":"^16.6.2","eslint-config-alloy":"^5.1.2","eslint-plugin-alloy":"^1.2.1","eslint-plugin-import":"^2.32.0","eslint-plugin-promise":"^6.6.0","eslint-config-prettier":"^9.1.2","eslint-plugin-prettier":"^5.5.5","@typescript-eslint/eslint-plugin":"^6.21.0"},"peerDependencies":{"typescript":"^5.8.3","@asenajs/asena":"^0.10.0"},"_npmOperationalInternal":{"tmp":"tmp/asena-logger_2.0.0_1785360201324_0.6798252889780081","host":"s3://npm-registry-packages-npm-production"}},"3.0.0":{"name":"@asenajs/asena-logger","version":"3.0.0","author":{"name":"LibirSoft"},"main":"dist/index.js","module":"index.ts","devDependencies":{"@asenajs/asena":"^0.11.0","@changesets/cli":"^2.31.1","@types/bun":"latest","@typescript-eslint/eslint-plugin":"^6.21.0","eslint":"^8.57.1","eslint-config-alloy":"^5.1.2","eslint-config-prettier":"^9.1.2","eslint-plugin-alloy":"^1.2.1","eslint-plugin-import":"^2.32.0","eslint-plugin-n":"^16.6.2","eslint-plugin-prettier":"^5.5.6","eslint-plugin-promise":"^6.6.0","prettier":"^3.9.6"},"peerDependencies":{"@asenajs/asena":"^0.11.0","typescript":"^5.8.3"},"description":"Just a logger for AsenaJS","license":"MIT","engines":{"bun":">=1.4.0"},"scripts":{"test":"bun test","test:watch":"bun test --watch","test:coverage":"bun test --coverage","build":"bun run clean && tsc","typecheck":"tsc -p tsconfig.typecheck.json","clean":"rm -rf dist","prepublishOnly":"bun run build","changeset":"changeset","version":"changeset version","release":"bun run build && changeset publish","lint":"eslint . --ext .ts","lint:fix":"eslint . --ext .ts --fix","format":"prettier --write .","format:check":"prettier --check .","check":"bun run lint && bun run format:check","check:fix":"bun run lint:fix && bun run format"},"types":"dist/index.d.ts","repository":{"type":"git","url":"git+https://github.com/AsenaJs/asena-logger.git"},"dependencies":{"winston":"^3.19.0"},"gitHead":"738f2789b4fe91e3f4bdded7ed738356222600b9","_id":"@asenajs/asena-logger@3.0.0","bugs":{"url":"https://github.com/AsenaJs/asena-logger/issues"},"homepage":"https://github.com/AsenaJs/asena-logger#readme","_nodeVersion":"26.7.0","_npmVersion":"12.0.2","dist":{"integrity":"sha512-ipxUSDhoBibdJ4Eml2INu0OSZGTmoONre6Pw923cW7x7glS64C039fN0IIzivLDyRC5s5S+NS/50yU43G4I/jQ==","shasum":"7c89e7eba5194852d77757edcec266719c9cc02f","tarball":"https://registry.npmjs.org/@asenajs/asena-logger/-/asena-logger-3.0.0.tgz","fileCount":9,"unpackedSize":16220,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQDGEGu8s+EMjTbAeDPZQm90ces085o7dYXp998RJg3m1QIgSPkexXQ2NrkT6d/sKKDYiYlmCCg3beldoH9xWgHAjQM="}]},"_npmUser":{"name":"libir","email":"libirsoft@gmail.com"},"directories":{},"maintainers":[{"name":"libir","email":"libirsoft@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/asena-logger_3.0.0_1787696234680_0.3521869545684313"},"_hasShrinkwrap":false}},"time":{"created":"2025-05-07T22:30:14.839Z","modified":"2026-08-25T22:17:15.006Z","1.0.0":"2025-05-07T22:30:15.134Z","2.0.0":"2026-07-29T21:23:21.482Z","3.0.0":"2026-08-25T22:17:14.821Z"},"bugs":{"url":"https://github.com/AsenaJs/asena-logger/issues"},"author":{"name":"LibirSoft"},"license":"MIT","homepage":"https://github.com/AsenaJs/asena-logger#readme","repository":{"type":"git","url":"git+https://github.com/AsenaJs/asena-logger.git"},"description":"Just a logger for AsenaJS","maintainers":[{"name":"libir","email":"libirsoft@gmail.com"}],"readme":"\n# AsenaLogger\n\n[![Version](https://img.shields.io/badge/version-3.0.0-blue.svg)](https://github.com/AsenaJs/asena-logger)\n[![Bun Version](https://img.shields.io/badge/Bun-1.4%2B-blueviolet)](https://bun.sh)\n\nJust a Winston-based logging solution for the Asena.js framework.\n\n## Requirements\n\n- [Bun](https://bun.sh) v1.4 or higher\n- [@asenajs/asena](https://github.com/AsenaJs/Asena) v0.11.0 or higher\n\n## Installation\n\n```bash\n# bun\nbun add @asenajs/asena-logger\n```\n\n## Features\n\n- Seamless integration with Asena ecosystem\n- Beautifully formatted console logs with timestamp and color-coded levels\n- Error handling with stack traces\n- Profile measurement for performance tracking\n- Customizable log formats and transports\n- Based on the robust Winston logging library\n\n## Basic Usage\n\n```typescript\nimport { AsenaLogger } from '@asenajs/asena-logger';\n\n// Create a logger instance with default settings\nconst logger = new AsenaLogger();\n\n// Log messages at different levels\nlogger.info('Server starting');\nlogger.debug('Configuration loaded', { config: 'production' });\nlogger.warn('Resource usage high', { memory: '85%' });\nlogger.error('Failed to connect to database',  new Error('Connection timeout') );\n\n// Use custom log levels\nlogger.log('verbose', 'Detailed information', { context: 'auth' });\n\n// Profile performance\nlogger.profile('database-query');\n// ... perform database operation\nlogger.profile('database-query'); // Logs the time elapsed since the first call\n```\n\n## Integration with Asena.js\n\nAsenaLogger is designed to work seamlessly with the Asena.js framework:\n\n```typescript\nimport { AsenaServer } from '@asenajs/asena';\nimport { HonoAdapter } from '@asenajs/hono-adapter';\nimport { AsenaLogger } from '@asenajs/asena-logger';\n\n// Create the logger\nconst logger = new AsenaLogger();\n\n// Pass to adapter\nconst adapter = new HonoAdapter(logger);\n\n// Pass to server\nawait new AsenaServer(adapter, logger)\n  .port(3000)\n  .start(true);\n```\n\n## Configuration\n\n### Custom Winston Instance\n\nYou can provide your own Winston logger instance:\n\n```typescript\nimport winston from 'winston';\nimport { AsenaLogger } from '@asenajs/asena-logger';\n\n// Create a custom Winston logger\nconst winstonLogger = winston.createLogger({\n  level: 'debug',\n  transports: [\n    new winston.transports.File({ filename: 'logs/error.log', level: 'error' }),\n    new winston.transports.File({ filename: 'logs/combined.log' })\n  ]\n});\n\n// Use it with AsenaLogger\nconst logger = new AsenaLogger(winstonLogger);\n```\n\n`Output`:\n\n```shell\n2025-05-08 00:06:07 [INFO]:     Server starting\n2025-05-08 00:06:07 [WARN]:     Resource usage high {\n \"memory\": \"85%\"\n}\n2025-05-08 00:06:07 [ERROR]:    Failed to connect to database Connection timeout\nError: Connection timeout\n    at path/to/good/place:14:51\n    at moduleEvaluation (native:1:11)\n    at moduleEvaluation (native:1:11)\n    at loadAndEvaluateModule (native:2)\n    at processTicksAndRejections (native:7:39)\n2025-05-08 00:06:07 [PROFILE]:  database-query 0ms\n```\n\n## Log Format\n\nBy default, logs are formatted as:\n\n```\nYYYY-MM-DD HH:mm:ss [LEVEL]: \tMessage {\"metadata\":\"values\"} \n```\n\nError logs include stack traces:\n\n```\nYYYY-MM-DD HH:mm:ss [ERROR]: \tDatabase connection failed {\"attempt\":3}\nError: Connection refused\n    at connectToDatabase (/app/services/db.js:42:11)\n    at startServer (/app/index.js:23:5)\n    ...\n```\n\n## API Reference\n\n### Methods\n\n- `info(message: string, meta?: any): void` - Log at info level\n- `error(message: string, meta?: any): void` - Log at error level\n- `warn(message: string, meta?: any): void` - Log at warn level\n- `debug(message: string, meta?: any): void` - Log at debug level\n- `log(level: string, message: string, meta?: any): void` - Log at custom level\n- `profile(id: string): void` - Start/stop profiling with the given ID\n\n## License\n\nMIT\n","readmeFilename":"README.md"}