{"_id":"@absolutejs/logs","_rev":"4-9b7b3ee3d8c426dba7488581c31674f7","name":"@absolutejs/logs","dist-tags":{"latest":"0.2.1"},"versions":{"0.1.0":{"name":"@absolutejs/logs","version":"0.1.0","keywords":["absolutejs","logs","logging","structured-logs","observability"],"author":"Alex Kahn","license":"BSL-1.1","_id":"@absolutejs/logs@0.1.0","maintainers":[{"name":"alexkahndev","email":"alexkahn2019@gmail.com"}],"dist":{"shasum":"5dd5e2da3cb09f8a214e1d31ce2572f2a45ee87b","tarball":"https://registry.npmjs.org/@absolutejs/logs/-/logs-0.1.0.tgz","fileCount":6,"integrity":"sha512-FcJzHPY4Ng8HNsdPL6jCvyvgcXbzEt2qgpPkGXXuMIqnIbD3hcaPGpThNbd6SPSFi/JdK3aaVWCCwOCtVqvX3g==","signatures":[{"sig":"MEUCIGUTyZsA2OXHw1MdcViDz61flElynVwqrmHJtdva5KFiAiEAtwtxmmpkhEovTfVO/F70B/cmj2uolihtzNB/X+zDZ20=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":42906},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","module":"./dist/index.js","shasum":"5dd5e2da3cb09f8a214e1d31ce2572f2a45ee87b","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","default":"./dist/index.js"}},"scripts":{"test":"bun test tests/","build":"rm -rf dist && bun build src/index.ts --outdir dist --sourcemap --target=bun && tsc --project tsconfig.build.json","format":"prettier --write \"./**/*.{ts,json,md}\"","release":"bun run format && bun run check:package && bun publish","typecheck":"tsc --noEmit","check:package":"bun run typecheck && bun run build && bun run test"},"_npmUser":{"name":"alexkahndev","email":"alexkahn2019@gmail.com"},"_integrity":"sha512-FcJzHPY4Ng8HNsdPL6jCvyvgcXbzEt2qgpPkGXXuMIqnIbD3hcaPGpThNbd6SPSFi/JdK3aaVWCCwOCtVqvX3g==","repository":{"url":"git+https://github.com/absolutejs/logs.git","type":"git"},"_npmVersion":"10.8.3","description":"Structured log primitive for the AbsoluteJS substrate. Levels, child loggers, sinks (console-JSON, console-pretty, memory, rotating file), optional secret redaction via @absolutejs/secrets, optional trace-id correlation via @absolutejs/telemetry. Metrics ","directories":{},"_nodeVersion":"24.3.0","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"prettier":"^3.8.3","@types/bun":"^1.3.14","typescript":"^5.9.0"},"peerDependencies":{"bun-types":"^1.3.14"},"_npmOperationalInternal":{"tmp":"tmp/logs_0.1.0_1780222775696_0.2214286409361339","host":"s3://npm-registry-packages-npm-production"}},"0.1.1":{"name":"@absolutejs/logs","version":"0.1.1","keywords":["absolutejs","logs","logging","structured-logs","observability"],"author":"Alex Kahn","license":"BSL-1.1","_id":"@absolutejs/logs@0.1.1","maintainers":[{"name":"alexkahndev","email":"alexkahn2019@gmail.com"}],"homepage":"https://github.com/absolutejs/logs","bugs":{"url":"https://github.com/absolutejs/logs/issues"},"dist":{"shasum":"058d58bc1f67cae9da6a2c491ee5d2da6683a470","tarball":"https://registry.npmjs.org/@absolutejs/logs/-/logs-0.1.1.tgz","fileCount":10,"integrity":"sha512-7+hELPmNJnYP1qF7ksPBiZ+Mt0szyGhVmsd5Adb8FEifrYZdF2XzQcusZjNNksH+OiDCqmN6p9DQQqm8v1+eQg==","signatures":[{"sig":"MEUCIBMnoOMTVKfyo33BTyhmHTjeLAA2vfAkLJO2Vxr9ctUUAiEApA0xzcjCyYh8UKw9QDHHW5QNWVpeY23rC0Nj06BTBsw=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":1140854},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","module":"./dist/index.js","shasum":"058d58bc1f67cae9da6a2c491ee5d2da6683a470","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","default":"./dist/index.js"},"./manifest":{"types":"./dist/manifest.d.ts","import":"./dist/manifest.js","default":"./dist/manifest.js"},"./manifest.json":"./dist/manifest.json"},"scripts":{"test":"bun test tests/","build":"rm -rf dist && bun build src/index.ts src/manifest.ts --outdir dist --sourcemap --target=bun && tsc --project tsconfig.build.json && absolute-manifest emit","format":"prettier --write \"./**/*.{ts,json,md}\"","release":"bun run format && bun run check:package && bun publish","typecheck":"tsc --noEmit","check:package":"bun run typecheck && bun run build && bun run test"},"_npmUser":{"name":"alexkahndev","email":"alexkahn2019@gmail.com"},"_integrity":"sha512-7+hELPmNJnYP1qF7ksPBiZ+Mt0szyGhVmsd5Adb8FEifrYZdF2XzQcusZjNNksH+OiDCqmN6p9DQQqm8v1+eQg==","absolutejs":{"manifestContract":1},"repository":{"url":"git+https://github.com/absolutejs/logs.git","type":"git"},"_npmVersion":"10.8.3","description":"Structured log primitive for the AbsoluteJS substrate. Levels, child loggers, sinks (console-JSON, console-pretty, memory, rotating file), optional secret redaction via @absolutejs/secrets, optional trace-id correlation via @absolutejs/telemetry. Metrics ","directories":{},"_nodeVersion":"24.3.0","dependencies":{"@sinclair/typebox":"^0.34.0","@absolutejs/manifest":"^0.1.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"prettier":"^3.8.3","@types/bun":"^1.3.14","typescript":"^5.9.0"},"peerDependencies":{"bun-types":"^1.3.14"},"_npmOperationalInternal":{"tmp":"tmp/logs_0.1.1_1783964178809_0.3985958276383812","host":"s3://npm-registry-packages-npm-production"}},"0.2.0":{"name":"@absolutejs/logs","version":"0.2.0","keywords":["absolutejs","logs","logging","structured-logs","observability"],"author":{"name":"Alex Kahn"},"license":"BSL-1.1","_id":"@absolutejs/logs@0.2.0","maintainers":[{"name":"alexkahndev","email":"alexkahn2019@gmail.com"}],"homepage":"https://github.com/absolutejs/logs","bugs":{"url":"https://github.com/absolutejs/logs/issues"},"dist":{"shasum":"d73d4996b549be8c5a9dbd02678149f224a783dd","tarball":"https://registry.npmjs.org/@absolutejs/logs/-/logs-0.2.0.tgz","fileCount":10,"integrity":"sha512-gsTt8uH4SajnqVAjwcHGJ81qHFB1GVvHBXD6NUy2Gs9VRhYe2vTCoNeO/k4NF4FX90elSz0PkgE2vReg6Sf6bg==","signatures":[{"sig":"MEUCIQCtVqLzpPr7SL8dEggQbL4bbLjfiXoG+eXJVHWtxeMPIgIgeBxfpYxAq2cde9R5BBVP2p7fgMQe9WTGDUqRs9GzonI=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":1163339},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","module":"./dist/index.js","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","default":"./dist/index.js"},"./manifest":{"types":"./dist/manifest.d.ts","import":"./dist/manifest.js","default":"./dist/manifest.js"},"./manifest.json":"./dist/manifest.json"},"gitHead":"586779b0b209426cc9e733fb442e5b8076bdc2e6","scripts":{"test":"bun test tests/","build":"rm -rf dist && bun build src/index.ts src/manifest.ts --outdir dist --sourcemap --target=bun && tsc --project tsconfig.build.json && absolute-manifest emit","format":"prettier --write \"./**/*.{ts,json,md}\"","release":"bun run format && bun run check:package && bun publish","typecheck":"tsc --noEmit","check:package":"bun run typecheck && bun run build && bun run test"},"_npmUser":{"name":"alexkahndev","email":"alexkahn2019@gmail.com"},"absolutejs":{"manifestContract":2},"repository":{"url":"git+https://github.com/absolutejs/logs.git","type":"git"},"_npmVersion":"10.9.2","description":"Structured log primitive for the AbsoluteJS substrate. Levels, child loggers, sinks (console-JSON, console-pretty, memory, rotating file), optional secret redaction via @absolutejs/secrets, optional trace-id correlation via @absolutejs/telemetry. Metrics ","directories":{},"_nodeVersion":"22.14.0","dependencies":{"@sinclair/typebox":"^0.34.0","@absolutejs/manifest":"^0.4.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"prettier":"^3.8.3","@types/bun":"^1.3.14","typescript":"^5.9.0"},"peerDependencies":{"bun-types":"^1.3.14"},"_npmOperationalInternal":{"tmp":"tmp/logs_0.2.0_1784807185193_0.7098612086584764","host":"s3://npm-registry-packages-npm-production"}},"0.2.1":{"name":"@absolutejs/logs","version":"0.2.1","description":"Structured log primitive for the AbsoluteJS substrate. Levels, child loggers, sinks (console-JSON, console-pretty, memory, rotating file), optional secret redaction via @absolutejs/secrets, optional trace-id correlation via @absolutejs/telemetry. Metrics ","repository":{"type":"git","url":"git+https://github.com/absolutejs/logs.git"},"homepage":"https://github.com/absolutejs/logs","bugs":{"url":"https://github.com/absolutejs/logs/issues"},"main":"./dist/index.js","module":"./dist/index.js","types":"./dist/index.d.ts","type":"module","license":"BSL-1.1","author":"Alex Kahn","absolutejs":{"manifestContract":2},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","default":"./dist/index.js"},"./manifest":{"types":"./dist/manifest.d.ts","import":"./dist/manifest.js","default":"./dist/manifest.js"},"./manifest.json":"./dist/manifest.json"},"publishConfig":{"access":"public"},"scripts":{"build":"rm -rf dist && bun build src/index.ts src/manifest.ts --outdir dist --sourcemap --target=bun && tsc --project tsconfig.build.json && absolute-manifest emit","test":"bun test tests/","typecheck":"tsc --noEmit","format":"prettier --write \"./**/*.{ts,json,md}\"","check:package":"bun run typecheck && bun run build && bun run test","release":"bun run format && bun run check:package && bun publish"},"keywords":["absolutejs","logs","logging","structured-logs","observability"],"dependencies":{"@absolutejs/manifest":"^0.7.1","@sinclair/typebox":"^0.34.0"},"devDependencies":{"@types/bun":"^1.3.14","prettier":"^3.8.3","typescript":"^5.9.0"},"_id":"@absolutejs/logs@0.2.1","_integrity":"sha512-OZNUPot0vByxEuhmoxybAobjcreQNilT24vGkEvk/xPYbxIe55kJI8qKDwayWYdjtosMPcTCB7J+3arehTgppg==","_nodeVersion":"24.3.0","_npmVersion":"10.8.3","shasum":"2be95b4f137822c3b62b43e4c2c48bd310f07442","dist":{"integrity":"sha512-OZNUPot0vByxEuhmoxybAobjcreQNilT24vGkEvk/xPYbxIe55kJI8qKDwayWYdjtosMPcTCB7J+3arehTgppg==","shasum":"2be95b4f137822c3b62b43e4c2c48bd310f07442","tarball":"https://registry.npmjs.org/@absolutejs/logs/-/logs-0.2.1.tgz","fileCount":10,"unpackedSize":505641,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQC9HgJVBVcM9qibm5La7xwXEiIbwnVd8e+3zFr6Ft+dXwIhAM0s4kptlzLlBDrlY7IPjSfiqgaMfhquHHDixlbB3Vxs"}]},"_npmUser":{"name":"alexkahndev","email":"alexkahn2019@gmail.com"},"directories":{},"maintainers":[{"name":"alexkahndev","email":"alexkahn2019@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/logs_0.2.1_1784915090899_0.17438439489015956"},"_hasShrinkwrap":false}},"time":{"created":"2026-05-31T10:19:35.516Z","modified":"2026-07-24T17:44:51.230Z","0.1.0":"2026-05-31T10:19:35.836Z","0.1.1":"2026-07-13T17:36:19.003Z","0.2.0":"2026-07-23T11:46:25.349Z","0.2.1":"2026-07-24T17:44:51.056Z"},"bugs":{"url":"https://github.com/absolutejs/logs/issues"},"author":"Alex Kahn","license":"BSL-1.1","homepage":"https://github.com/absolutejs/logs","keywords":["absolutejs","logs","logging","structured-logs","observability"],"repository":{"type":"git","url":"git+https://github.com/absolutejs/logs.git"},"description":"Structured log primitive for the AbsoluteJS substrate. Levels, child loggers, sinks (console-JSON, console-pretty, memory, rotating file), optional secret redaction via @absolutejs/secrets, optional trace-id correlation via @absolutejs/telemetry. Metrics ","maintainers":[{"name":"alexkahndev","email":"alexkahn2019@gmail.com"}],"readme":"# @absolutejs/logs\n\nStructured log primitive for the AbsoluteJS substrate. Levels, child\nloggers, sinks (console-JSON, console-pretty, memory, rotating file),\noptional secret redaction via\n[`@absolutejs/secrets`](https://github.com/absolutejs/secrets),\noptional trace-id correlation via\n[`@absolutejs/telemetry`](https://github.com/absolutejs/telemetry).\n\n## Install\n\n```bash\nbun add @absolutejs/logs\n```\n\n## Quick start\n\n```ts\nimport { createLogger, consoleJsonSink, rotatingFileSink } from '@absolutejs/logs';\nimport { readActiveTraceId } from '@absolutejs/telemetry';\n\nconst log = createLogger({\n  level: 'info',\n  fields: { service: 'api', region: 'us-east-2' },\n  sinks: [\n    consoleJsonSink(),\n    rotatingFileSink({ path: '/var/log/api/app.log', maxBytes: 10_000_000, keep: 5 }),\n  ],\n  redact: (text) => broker.redact(text),     // @absolutejs/secrets\n  readTraceId: readActiveTraceId,            // @absolutejs/telemetry\n});\n\nlog.info('User signed in', { userId: 'u_42', tenant: 'acme' });\n// → {\"at\":1700000000000,\"level\":\"info\",\"message\":\"User signed in\",\"tenant\":\"acme\",\"traceId\":\"abc123\",\"fields\":{\"service\":\"api\",\"region\":\"us-east-2\",\"userId\":\"u_42\"}}\n\nconst requestLog = log.child({ requestId: req.id });\nrequestLog.warn('rate limit exceeded', { remaining: 0 });\n// Same as parent, plus requestId in fields.\n```\n\n## Levels\n\n`trace` → `debug` → `info` → `warn` → `error` → `fatal`. Filter at\n`level`; bump at runtime with `log.setLevel('debug')` (SIGUSR2-style\nincident triage).\n\n## Sinks\n\n| Sink | Purpose |\n| --- | --- |\n| `consoleJsonSink()` | One JSON line per event. stdout for `< errorThreshold`, stderr above. |\n| `consolePrettySink()` | Human-readable lines for local dev. |\n| `memorySink()` | In-process FIFO buffer. `.inspect()` + `.clear()` for tests. |\n| `rotatingFileSink({ path, maxBytes, keep })` | Append-only file with size-based rotation. |\n\nCustom sinks just implement `LogSink`: `{ name?, write, flush?, close? }`.\n\n## Composition\n\n- **`@absolutejs/secrets` redaction.** Pass `redact: broker.redact` and\n  every serialized event flows through the redactor before hitting a\n  sink. Secrets never reach disk.\n- **`@absolutejs/telemetry` trace correlation.** Pass `readTraceId:\n  readActiveTraceId` and every event carries the active OTel trace id.\n  Failure (no provider wired) silently leaves `traceId` off — never\n  breaks the log line.\n- **`@absolutejs/metrics` exposure.** `logger.metrics()` returns a\n  `LoggerMetrics` shape. A `@absolutejs/metrics/logs` collector\n  subpath is planned for the next release.\n\n## Metrics\n\n```ts\nlogger.metrics();\n// {\n//   logged: { trace: 0, debug: 0, info: 100, warn: 5, error: 2, fatal: 0 },\n//   writes: 214,          // 107 events × 2 sinks\n//   writeErrors: 0,\n//   sinkErrors: {}\n// }\n```\n\n## Operator notes\n\n- **Fire-and-forget writes.** `log.info(...)` is synchronous and\n  returns immediately; sink writes run in the background. Use\n  `await log.flush()` before shutdown.\n- **Per-sink failures don't block others.** One sink throwing\n  bumps `sinkErrors[name]` and calls `onError`; the rest still\n  receive the event. Same shape as `@absolutejs/audit`.\n- **Closed loggers drop calls silently.** Once `await log.close()`\n  has run, further `log.info(...)` calls are no-ops — no throw,\n  no buffer.\n\n## License\n\nBSL-1.1 with named carveout against hosted log-management platforms.\nChange date: 2030-05-31 (Apache 2.0).\n","readmeFilename":"README.md"}