{"_id":"@commercelayer/hono-pino-logger","_rev":"3-9ceec668cb58161374da48a55ead5dee","name":"@commercelayer/hono-pino-logger","dist-tags":{"latest":"2.8.5"},"versions":{"2.7.0":{"name":"@commercelayer/hono-pino-logger","version":"2.7.0","keywords":["commercelayer","hono","pino","logger","logging","middleware","http","request","response"],"author":{"name":"Commerce Layer","email":"development@commercelayer.io"},"license":"MIT","_id":"@commercelayer/hono-pino-logger@2.7.0","maintainers":[{"name":"drpierlu","email":"pierluigi@commercelayer.io"},{"name":"commercelayer.io","email":"subscriptions@commercelayer.io"}],"homepage":"https://github.com/commercelayer/common-utils/tree/main/packages/hono-pino-logger#readme","bugs":{"url":"https://github.com/commercelayer/common-utils/issues"},"dist":{"shasum":"727d499d7a614b1c8e6e0bde0806e0d7436bad4d","tarball":"https://registry.npmjs.org/@commercelayer/hono-pino-logger/-/hono-pino-logger-2.7.0.tgz","fileCount":9,"integrity":"sha512-ZBJr4xOoNh5he+FbLo57hQnpVanP2DL/vCOfcK97iuokNxC7fsERpxSFXO796v+GDmM09zQAKGvqPNuYsMd2Dw==","signatures":[{"sig":"MEUCIQCV+nGxZqI/Ce5t7ZTx7L6rCqn33LYTd+qg1bkOYzkuBQIgUy/6P/DEvpP00hg2kxmLKGmpT2HldO3RslxComNG74M=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":36987},"type":"module","_from":"file:commercelayer-hono-pino-logger-2.7.0.tgz","types":"./dist/index.d.ts","module":"./dist/index.js","engines":{"node":">=18","pnpm":">=7"},"exports":{".":{"import":"./dist/index.js","require":"./dist/index.cjs"}},"scripts":{"lint":"pnpm biome check src","test":"pnpm run lint && vitest run --silent","build":"tsup","lint:fix":"pnpm biome check src --write","jsr:publish":"pnpx jsr publish","test:verbose":"pnpm run lint && vitest run --silent=false"},"_npmUser":{"name":"commercelayer.io","email":"subscriptions@commercelayer.io"},"_resolved":"/private/var/folders/k8/5scbytv162nghsnjsz36vbjr0000gn/T/95906e292ba25023ed385e3092a4c17f/commercelayer-hono-pino-logger-2.7.0.tgz","copyright":"©2026 Commerce Layer Inc.","_integrity":"sha512-ZBJr4xOoNh5he+FbLo57hQnpVanP2DL/vCOfcK97iuokNxC7fsERpxSFXO796v+GDmM09zQAKGvqPNuYsMd2Dw==","repository":{"url":"git+https://github.com/commercelayer/common-utils.git","type":"git","directory":"packages/hono-pino-logger"},"_npmVersion":"11.6.2","description":"Pino logger middleware for Hono with request/response logging","directories":{},"_nodeVersion":"24.11.1","dependencies":{"pino":"^9.6.0","pino-http":"^10.3.0"},"_hasShrinkwrap":false,"devDependencies":{"hono":"^4.6.15","tsup":"^8.3.5","vitest":"^3.0.5","typescript":"^5.7.3","@types/node":"^24.10.1","pino-pretty":"^13.0.0","@biomejs/biome":"^2.3.9","@hono/node-server":"^1.14.0"},"peerDependencies":{"hono":"^4.0.0","@hono/node-server":"^1.0.0"},"_npmOperationalInternal":{"tmp":"tmp/hono-pino-logger_2.7.0_1770052465147_0.38352669202709144","host":"s3://npm-registry-packages-npm-production"}},"2.8.0":{"name":"@commercelayer/hono-pino-logger","version":"2.8.0","keywords":["commercelayer","hono","pino","logger","logging","middleware","http","request","response"],"author":{"name":"Commerce Layer","email":"development@commercelayer.io"},"license":"MIT","_id":"@commercelayer/hono-pino-logger@2.8.0","maintainers":[{"name":"drpierlu","email":"pierluigi@commercelayer.io"},{"name":"commercelayer.io","email":"subscriptions@commercelayer.io"}],"homepage":"https://github.com/commercelayer/common-utils/tree/main/packages/hono-pino-logger#readme","bugs":{"url":"https://github.com/commercelayer/common-utils/issues"},"dist":{"shasum":"371e88641243f4e1242aa3bbb3f21c16e33f2bb3","tarball":"https://registry.npmjs.org/@commercelayer/hono-pino-logger/-/hono-pino-logger-2.8.0.tgz","fileCount":9,"integrity":"sha512-H6k1Xl8fOOgtswC4221wjH1P63ZKl8xtVkL1TGuCSISV/REgYES04AgflZvcBV563+IkHyMGkePTXBzkZfOS4Q==","signatures":[{"sig":"MEUCIA3TOpc/epuAakCDsT4Rd66vM2YcsoqTWGkSGotbGj1LAiEAkFADpoCLOvmn1sMZRqc2xf0+vshjM27MdtHQ2qMGbXI=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@commercelayer%2fhono-pino-logger@2.8.0","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":36798},"type":"module","_from":"file:commercelayer-hono-pino-logger-2.8.0.tgz","types":"./dist/index.d.ts","module":"./dist/index.js","engines":{"node":">=18","pnpm":">=7"},"exports":{".":{"import":"./dist/index.js","require":"./dist/index.cjs"}},"scripts":{"lint":"pnpm biome check src","test":"pnpm run lint && vitest run --silent","build":"tsup","lint:fix":"pnpm biome check src --write","jsr:publish":"pnpx jsr publish","test:verbose":"pnpm run lint && vitest run --silent=false"},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:c54764a2-fee1-4629-9fe3-ca3c925d62af"}},"_resolved":"/tmp/8bfa19399ea31a84abe47db8ef3efe6c/commercelayer-hono-pino-logger-2.8.0.tgz","copyright":"©2026 Commerce Layer Inc.","_integrity":"sha512-H6k1Xl8fOOgtswC4221wjH1P63ZKl8xtVkL1TGuCSISV/REgYES04AgflZvcBV563+IkHyMGkePTXBzkZfOS4Q==","repository":{"url":"git+https://github.com/commercelayer/common-utils.git","type":"git","directory":"packages/hono-pino-logger"},"_npmVersion":"11.11.0","description":"Pino logger middleware for Hono with request/response logging","directories":{},"_nodeVersion":"20.20.0","dependencies":{"pino":"^9.6.0","pino-http":"^10.3.0"},"_hasShrinkwrap":false,"devDependencies":{"hono":"^4.6.15","tsup":"^8.3.5","vitest":"^3.0.5","typescript":"^5.7.3","@types/node":"^24.10.1","pino-pretty":"^13.0.0","@biomejs/biome":"^2.3.9","@hono/node-server":"^1.14.0"},"peerDependencies":{"hono":"^4.0.0","@hono/node-server":"^1.0.0"},"_npmOperationalInternal":{"tmp":"tmp/hono-pino-logger_2.8.0_1772614650234_0.8450824377460622","host":"s3://npm-registry-packages-npm-production"}},"2.8.5":{"_id":"@commercelayer/hono-pino-logger@2.8.5","bugs":{"url":"https://github.com/commercelayer/common-utils/issues"},"dist":{"shasum":"a8102ca650fcb712efb3ae02c671ec37f2b232ce","tarball":"https://registry.npmjs.org/@commercelayer/hono-pino-logger/-/hono-pino-logger-2.8.5.tgz","fileCount":9,"integrity":"sha512-AOxOERokzW6Lsp8i68vz4DujOWzgvMfvTVV5na3pvjgXyRnliGZZ99WQWuctzMBpH/ByBkeUtf1ynwMkQ8PsVA==","signatures":[{"sig":"MEYCIQDdDHOI6P+8MHxqN2gbFAbfhNoLICwO0yAyoJ/COvZyeQIhANv1Z/+0Tn0p9tS2t9zA540a53tQM8fD4fNq0HBUGpcN","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"},{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCIHKIe+eho/6J/HRagpfZNh3bS2c/AD+0On9Tn99qp39nAiBf2g4BJIbQOJFM8G20aGkmFJ3LfpreyayEhTmZR9MW5Q=="}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@commercelayer%2fhono-pino-logger@2.8.5","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":36988},"name":"@commercelayer/hono-pino-logger","type":"module","_from":"file:commercelayer-hono-pino-logger-2.8.5.tgz","types":"./dist/index.d.ts","author":{"name":"Commerce Layer","email":"development@commercelayer.io"},"module":"./dist/index.js","engines":{"node":">=20","pnpm":">=7"},"exports":{".":{"import":"./dist/index.js","require":"./dist/index.cjs"}},"license":"MIT","scripts":{"lint":"pnpm biome check src","test":"pnpm run lint && vitest run --silent","build":"tsup","lint:fix":"pnpm biome check src --write","jsr:publish":"pnpx jsr publish","test:verbose":"pnpm run lint && vitest run --silent=false"},"version":"2.8.5","_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:c54764a2-fee1-4629-9fe3-ca3c925d62af"}},"homepage":"https://github.com/commercelayer/common-utils/tree/main/packages/hono-pino-logger#readme","keywords":["commercelayer","hono","pino","logger","logging","middleware","http","request","response"],"_resolved":"/tmp/4e4507119a899fb529180cf881ee8872/commercelayer-hono-pino-logger-2.8.5.tgz","copyright":"©2026 Commerce Layer Inc.","_integrity":"sha512-AOxOERokzW6Lsp8i68vz4DujOWzgvMfvTVV5na3pvjgXyRnliGZZ99WQWuctzMBpH/ByBkeUtf1ynwMkQ8PsVA==","repository":{"url":"git+https://github.com/commercelayer/common-utils.git","type":"git","directory":"packages/hono-pino-logger"},"_npmVersion":"12.0.2","description":"Pino logger middleware for Hono with request/response logging","directories":{},"maintainers":[{"name":"drpierlu","email":"pierluigi@commercelayer.io"},{"name":"commercelayer.io","email":"subscriptions@commercelayer.io"}],"_nodeVersion":"24.20.0","dependencies":{"pino":"^10.3.1","pino-http":"^11.0.0"},"_hasShrinkwrap":false,"devDependencies":{"hono":"^4.13.8","tsup":"^8.5.1","vitest":"^5.0.1","typescript":"^5.9.3","@types/node":"^26.6.1","pino-pretty":"^13.1.3","@biomejs/biome":"^2.5.14","@hono/node-server":"^2.1.1"},"peerDependencies":{"hono":"^4.0.0","@hono/node-server":"^1.0.0 || ^2.0.0"},"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/hono-pino-logger_2.8.5_1790082087955_0.08971121739749988"}}},"time":{"created":"2026-02-02T17:14:25.083Z","modified":"2026-09-22T13:01:28.593Z","2.7.0":"2026-02-02T17:14:25.311Z","2.8.0":"2026-03-04T08:57:30.389Z","2.8.5":"2026-09-22T13:01:28.057Z"},"bugs":{"url":"https://github.com/commercelayer/common-utils/issues"},"author":{"name":"Commerce Layer","email":"development@commercelayer.io"},"license":"MIT","homepage":"https://github.com/commercelayer/common-utils/tree/main/packages/hono-pino-logger#readme","keywords":["commercelayer","hono","pino","logger","logging","middleware","http","request","response"],"repository":{"url":"git+https://github.com/commercelayer/common-utils.git","type":"git","directory":"packages/hono-pino-logger"},"description":"Pino logger middleware for Hono with request/response logging","maintainers":[{"name":"drpierlu","email":"pierluigi@commercelayer.io"},{"name":"commercelayer.io","email":"subscriptions@commercelayer.io"}],"readme":"# @commercelayer/hono-pino-logger\n\nPino logger middleware for Hono with built-in request/response logging support. Designed for use with `@hono/node-server`.\n\n## Features\n\n- 🚀 Fast and lightweight logging powered by Pino\n- 🎯 Seamless integration with Hono applications\n- 📊 Automatic HTTP request/response logging\n- 🎨 Pretty printing in development\n- 🔧 Fully configurable and extensible\n- 📦 TypeScript first with complete type definitions\n- 🌐 Works with `@hono/node-server`\n\n## Installation\n\n```bash\npnpm add @commercelayer/hono-pino-logger\n# or\nnpm install @commercelayer/hono-pino-logger\n# or\nyarn add @commercelayer/hono-pino-logger\n```\n\n### Requirements\n\n- Node.js `>=20`\n\n### Peer Dependencies\n\nThis package requires:\n- `hono` (^4.0.0)\n- `@hono/node-server` (^1.0.0 || ^2.0.0)\n\nFor development pretty printing, install:\n```bash\npnpm add -D pino-pretty\n```\n\n## Quick Start\n\n### Basic Usage\n\n```typescript\nimport { Hono } from 'hono'\nimport { serve } from '@hono/node-server'\nimport { honoHttpLogger } from '@commercelayer/hono-pino-logger'\n\nconst app = new Hono()\n\n// Add logger middleware\napp.use('*', honoHttpLogger())\n\napp.get('/', (c) => {\n  return c.text('Hello World!')\n})\n\nserve(app)\n```\n\n### With Custom Logger Configuration\n\n```typescript\nimport { Hono } from 'hono'\nimport { createLogger, honoHttpLogger } from '@commercelayer/hono-pino-logger'\n\nconst app = new Hono()\n\n// Create a custom logger\nconst customLogger = createLogger({\n  level: 'debug',\n  prettyPrint: true,\n  redactPaths: ['req.headers.authorization']\n})\n\n// Use custom logger in middleware\napp.use('*', honoHttpLogger({ logger: customLogger }))\n\napp.get('/', (c) => {\n  // Access logger from context\n  const logger = c.get('logger')\n  logger.info('Processing request')\n\n  return c.json({ message: 'Hello' })\n})\n```\n\n## API Reference\n\n### `honoHttpLogger(config?)`\n\nHono middleware for logging HTTP requests and responses.\n\n**Parameters:**\n- `config.logger` (optional): Custom Pino logger instance\n- `config.logRequestBody` (optional): Log request body (default: `false`)\n- `config.minimalOutput` (optional): Only output log message without extra attributes (default: `false`)\n\n**Returns:** Hono middleware function\n\n**Example:**\n```typescript\napp.use('*', honoHttpLogger({\n  logRequestBody: true\n}))\n\n// Minimal output (only message, no extra attributes)\napp.use('*', honoHttpLogger({\n  minimalOutput: true\n}))\n```\n\n### `createLogger(config?)`\n\nCreates a Pino logger instance with custom configuration.\n\n**Parameters:**\n- `config.level` (optional): Minimum log level (default: `process.env.LOG_LEVEL ?? 'info'`)\n- `config.prettyPrint` (optional): Enable pretty printing (default: `process.env.NODE_ENV !== 'production'`)\n- `config.redactPaths` (optional): Array of paths to redact from logs\n- `config.customFormatters` (optional): Custom Pino formatters\n- `config.serializers` (optional): Custom Pino serializers\n\n**Returns:** Pino logger instance\n\n**Example:**\n```typescript\nconst logger = createLogger({\n  level: 'debug',\n  redactPaths: ['password', 'token']\n})\n\nlogger.info('Application started')\nlogger.error({ err: new Error('Failed') }, 'Error occurred')\n```\n\n### `logger`\n\nDefault logger instance using environment-based configuration.\n\n**Example:**\n```typescript\nimport { logger } from '@commercelayer/hono-pino-logger'\n\nlogger.info('Using default logger')\n```\n\n## Configuration\n\n### Environment Variables\n\n- `LOG_LEVEL`: Set the minimum log level (default: `info`)\n- `NODE_ENV`: When set to `production`, disables pretty printing\n\n**Example:**\n```bash\nLOG_LEVEL=debug NODE_ENV=development node server.js\n```\n\n### Logging Levels\n\nAvailable log levels (in order of priority):\n- `fatal`\n- `error`\n- `warn`\n- `info`\n- `debug`\n- `trace`\n\n## Advanced Usage\n\n### Access Logger in Route Handlers\n\nThe logger is automatically attached to the Hono context:\n\n```typescript\napp.get('/user/:id', async (c) => {\n  const logger = c.get('logger')\n  const userId = c.req.param('id')\n\n  logger.info({ userId }, 'Fetching user')\n\n  // Your logic here\n\n  return c.json({ id: userId })\n})\n```\n\n### Request ID Tracking\n\nIf you set a `requestId` in the Hono context, it will be included in logs:\n\n```typescript\nimport { requestId } from \"hono/request-id\"\n\napp.use(requestId())\n\napp.use('*', honoHttpLogger())\n```\n\n### Selective Logging\n\nApply logging only to specific routes:\n\n```typescript\nconst app = new Hono()\n\n// Log only API routes\napp.use('/api/*', honoHttpLogger())\n\n// Public routes without logging\napp.get('/', (c) => c.text('Home'))\n```\n\n### Minimal Output\n\nFor cleaner logs without extra attributes:\n\n```typescript\n// Only outputs: method=GET path=/users status=200 duration=45ms\napp.use(honoHttpLogger({\n  minimalOutput: true\n}))\n\n// Default includes: request_id, user_agent, ip, http.request, http.response\napp.use(honoHttpLogger())\n```\n\n## Log Output\n\n### Development (Pretty Print)\n\n**Default:**\n```\n[2026-01-29 10:30:45] INFO: method=GET path=/api/users status=200 duration=45ms\n    request_id: \"abc-123\"\n    user_agent: \"Mozilla/5.0...\"\n    ip: \"192.168.1.1\"\n```\n\n**Minimal Output:**\n```\n[2026-01-29 10:30:45] INFO: method=GET path=/api/users status=200 duration=45ms\n```\n\n### Production (JSON)\n\n**Default:**\n```json\n{\n  \"level\": \"INFO\",\n  \"time\": 1738152645000,\n  \"msg\": \"method=GET path=/api/users status=200 duration=45ms\",\n  \"request_id\": \"abc-123\",\n  \"user_agent\": \"Mozilla/5.0...\",\n  \"host\": \"api.example.com\",\n  \"ip\": \"192.168.1.1\",\n  \"protocol\": \"https\",\n  \"http.request\": {\n    \"method\": \"GET\",\n    \"url\": \"/api/users\",\n    \"query\": \"\",\n    \"remote_address\": \"192.168.1.1\",\n    \"remote_port\": 54153\n  },\n  \"http.response\": {\n    \"statusCode\": 200,\n    \"headers\": {}\n  },\n  \"http.responseTime\": 45\n}\n```\n\n**Minimal Output:**\n```json\n{\n  \"level\": \"INFO\",\n  \"time\": 1738152645000,\n  \"msg\": \"method=GET path=/api/users status=200 duration=45ms\"\n}\n```\n\n## TypeScript\n\nFull TypeScript support with exported types:\n\n```typescript\nimport type {\n  LoggerConfig,\n  HttpLoggerConfig,\n  RequestLogger\n} from '@commercelayer/hono-pino-logger'\n\nconst config: LoggerConfig = {\n  level: 'debug',\n  prettyPrint: true\n}\n```\n\n## Contributing\n\nContributions are welcome! Please read our contributing guidelines before submitting PRs.\n\n## License\n\nMIT License - see the [LICENSE](LICENSE) file for details.\n\n## Support\n\nFor issues and questions:\n- [GitHub Issues](https://github.com/commercelayer/common-utils/issues)\n- [Documentation](https://github.com/commercelayer/common-utils)\n","readmeFilename":"README.md"}