{"_id":"@ambiten/logger","_rev":"2-2a6a56c34be4db0d1bfeef6a40a1a0bd","name":"@ambiten/logger","dist-tags":{"latest":"1.0.1"},"versions":{"1.0.0":{"name":"@ambiten/logger","version":"1.0.0","keywords":["Ambiten","logger","observability","transport","metadata","Advance logging"],"author":{"name":"Emmanuel Nodolomwanyi"},"license":"ISC","_id":"@ambiten/logger@1.0.0","maintainers":[{"name":"abimongo","email":"padave805@gmail.com"}],"homepage":"https://ambiten.dev","bugs":{"url":"https://github.com/AmbitenHQ/ambiten/issues"},"dist":{"shasum":"ae68726722f7f61ab1518a7fe9809bd2bde73db9","tarball":"https://registry.npmjs.org/@ambiten/logger/-/logger-1.0.0.tgz","fileCount":99,"integrity":"sha512-0WxXWIlp3fWKSeNcagRwC0oMgn4D3vqTuee75LHFEs+9AIW5WwwLV17itdU/BPoMeSKZL5LDZegZrjBAFJkZDA==","signatures":[{"sig":"MEYCIQCoGLozArOF533gEBT/s5cOgIKEoD0E44I/KShAmIoVGQIhAOTRrnGwUt6XaBRYOawDDHLkXSSHJX6AYDND68nxRsAt","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":109843},"main":"./dist/index.js","_from":"file:ambiten-logger-1.0.0.tgz","types":"./dist/index.d.ts","module":"./dist/index.js","browser":{"http2":false,"async_hooks":false},"engines":{"node":">=20.11.0"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","require":"./dist/index.js"},"./package.json":"./package.json"},"release":{"branches":["main"]},"scripts":{"test":"jest --detectOpenHandles --coverage","build":"tsc -b tsconfig.json --force","clean":"tsc -b tsconfig.json --clean && rimraf dist","start":"ts-node src/index.ts","release":"pnpm changeset version && pnpm install && pnpm build && changeset publish","typedoc":"typedoc --options typedoc.json","changeset":"changeset"},"_npmUser":{"name":"abimongo","email":"padave805@gmail.com"},"_resolved":"/tmp/42ec3a1281a9e8a3ca1bc35b9fb69579/ambiten-logger-1.0.0.tgz","_integrity":"sha512-0WxXWIlp3fWKSeNcagRwC0oMgn4D3vqTuee75LHFEs+9AIW5WwwLV17itdU/BPoMeSKZL5LDZegZrjBAFJkZDA==","repository":{"url":"git+https://github.com/AmbitenHQ/ambiten.git","type":"git","directory":"packages/logger"},"_npmVersion":"11.17.0","description":"<div style=\"display: flex; align-items: center;\"> <p >   <img     src=\"https://raw.githubusercontent.com/AmbitenHQ/ambiten/main/assets/ambiten-mark-192x192.png\"     width=\"56\"     alt=\"Ambiten\"   />   </p> <h2> @ambiten/logger</h2> </div>","directories":{},"sideEffects":false,"_nodeVersion":"22.22.3","dependencies":{"axios":"^1.13.2","@babel/runtime":"^7.28.4"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"tsx":"^4.21.0","jest":"^29.7.0","tslib":"2.8.1","ts-jest":"^29.4.6","ts-node":"10.9.2","typedoc":"^0.28.15","webpack":"5.104.1","@types/ws":"^8.18.1","ts-loader":"^9.5.4","babel-jest":"^29.7.0","typescript":"5.9.3","@babel/core":"^7.28.5","@types/jest":"^29.5.14","@types/node":"^22.19.3","webpack-cli":"6.0.1","babel-loader":"^10.0.0","@types/webpack":"^5.28.5","@changesets/cli":"^2.29.8","path-browserify":"^1.0.1","@babel/preset-env":"^7.28.5","webpack-remove-debug":"0.1.0","typedoc-plugin-markdown":"^4.9.0","@babel/preset-typescript":"^7.28.5","@testing-library/jest-dom":"^6.9.1","tsconfig-paths-webpack-plugin":"^4.2.0","@babel/plugin-transform-runtime":"^7.28.5","@babel/plugin-transform-modules-commonjs":"^7.27.1"},"_npmOperationalInternal":{"tmp":"tmp/logger_1.0.0_1781347270162_0.7601196152277379","host":"s3://npm-registry-packages-npm-production"}},"1.0.1":{"name":"@ambiten/logger","version":"1.0.1","publishConfig":{"access":"public"},"main":"./dist/index.js","module":"./dist/index.js","types":"./dist/index.d.ts","sideEffects":false,"browser":{"async_hooks":false,"http2":false},"exports":{".":{"import":"./dist/index.js","require":"./dist/index.js","types":"./dist/index.d.ts"},"./package.json":"./package.json"},"release":{"branches":["main"]},"keywords":["Ambiten","logger","observability","transport","metadata","Advance logging"],"author":{"name":"Emmanuel Nodolomwanyi"},"maintainers":[{"name":"abimongo","email":"padave805@gmail.com"}],"license":"ISC","description":"<div style=\"display: flex; align-items: center;\"> <p >   <img     src=\"https://raw.githubusercontent.com/AmbitenHQ/ambiten/main/assets/ambiten-mark-192x192.png\"     width=\"56\"     alt=\"Ambiten\"   />   </p> <h2> @ambiten/logger</h2> </div>","repository":{"type":"git","url":"git+https://github.com/AmbitenHQ/ambiten.git","directory":"packages/logger"},"bugs":{"url":"https://github.com/AmbitenHQ/ambiten/issues"},"homepage":"https://docs.ambiten.dev","devDependencies":{"@babel/core":"^7.28.5","@babel/plugin-transform-modules-commonjs":"^7.27.1","@babel/plugin-transform-runtime":"^7.28.5","@babel/preset-env":"^7.28.5","@babel/preset-typescript":"^7.28.5","@changesets/cli":"^2.29.8","@testing-library/jest-dom":"^6.9.1","@types/jest":"^29.5.14","@types/node":"^22.19.3","@types/webpack":"^5.28.5","@types/ws":"^8.18.1","babel-jest":"^29.7.0","babel-loader":"^10.0.0","jest":"^29.7.0","path-browserify":"^1.0.1","ts-jest":"^29.4.6","ts-loader":"^9.5.4","ts-node":"10.9.2","tsconfig-paths-webpack-plugin":"^4.2.0","tslib":"2.8.1","tsx":"^4.21.0","typedoc":"^0.28.15","typedoc-plugin-markdown":"^4.9.0","typescript":"5.9.3","webpack":"5.104.1","webpack-cli":"6.0.1","webpack-remove-debug":"0.1.0"},"dependencies":{"@babel/runtime":"^7.28.4","axios":"^1.13.2"},"engines":{"node":">=20.11.0"},"scripts":{"start":"ts-node src/index.ts","build":"tsc -b tsconfig.json --force","test":"jest --detectOpenHandles --coverage","changeset":"changeset","release":"pnpm changeset version && pnpm install && pnpm build && changeset publish","typedoc":"typedoc --options typedoc.json","clean":"tsc -b tsconfig.json --clean && rimraf dist"},"_id":"@ambiten/logger@1.0.1","_integrity":"sha512-AZZrCcgu2fYz5dXLcxdKFLqxx0W/v2VoF6SfpKZB1ui9tl82BusfwD5B1CdQSUMBsizVi4olCBw3NriWSI1U1A==","_resolved":"/tmp/51102d298ffdd71c7a97e0b672a4bccb/ambiten-logger-1.0.1.tgz","_from":"file:ambiten-logger-1.0.1.tgz","_nodeVersion":"22.23.1","_npmVersion":"12.0.2","dist":{"integrity":"sha512-AZZrCcgu2fYz5dXLcxdKFLqxx0W/v2VoF6SfpKZB1ui9tl82BusfwD5B1CdQSUMBsizVi4olCBw3NriWSI1U1A==","shasum":"ac301f0a66fb604abeb4d7d5e264086739adda05","tarball":"https://registry.npmjs.org/@ambiten/logger/-/logger-1.0.1.tgz","fileCount":99,"unpackedSize":109853,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQCjQYw2vt83rP4OBCJ2zAE4Q0kGbnxvAQOUwnK28TmWCwIgFH+RxD/5k7Ar3+jKP3OhUC8l5F0+ndvaq1msMM4aBJo="}]},"_npmUser":{"name":"abimongo","email":"padave805@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/logger_1.0.1_1785956595366_0.11653005137354056"},"_hasShrinkwrap":false}},"time":{"created":"2026-06-13T10:41:09.994Z","modified":"2026-08-05T19:03:15.734Z","1.0.0":"2026-06-13T10:41:10.301Z","1.0.1":"2026-08-05T19:03:15.533Z"},"bugs":{"url":"https://github.com/AmbitenHQ/ambiten/issues"},"author":{"name":"Emmanuel Nodolomwanyi"},"license":"ISC","homepage":"https://docs.ambiten.dev","keywords":["Ambiten","logger","observability","transport","metadata","Advance logging"],"repository":{"type":"git","url":"git+https://github.com/AmbitenHQ/ambiten.git","directory":"packages/logger"},"description":"<div style=\"display: flex; align-items: center;\"> <p >   <img     src=\"https://raw.githubusercontent.com/AmbitenHQ/ambiten/main/assets/ambiten-mark-192x192.png\"     width=\"56\"     alt=\"Ambiten\"   />   </p> <h2> @ambiten/logger</h2> </div>","maintainers":[{"name":"abimongo","email":"padave805@gmail.com"}],"readme":"<div style=\"display: flex; align-items: center;\">\n<p >\n  <img\n    src=\"https://raw.githubusercontent.com/AmbitenHQ/ambiten/main/assets/ambiten-mark-192x192.png\"\n    width=\"56\"\n    alt=\"Ambiten\"\n  />  \n</p> <h2> @ambiten/logger</h2>\n</div> \n\n<p align=\"center\">\n  <strong>Structured logging and runtime-aware telemetry for modern applications.</strong>\n</p>\n\n<p align=\"center\">\n  Context-aware logs, transport pipelines, metrics tracking, resilience handling, and production-grade operational visibility for Ambiten systems and standalone Node.js applications.\n</p>\n\n<p align=\"center\">\n<a href=\"https://www.npmjs.com/package/@ambiten/logger\">\n  <img src=\"https://img.shields.io/npm/v/@ambiten/logger?color=0ea5e9&label=npm&style=flat-square\" alt=\"npm version\" />\n</a>\n<!-- <a href=\"https://ambiten.dev\">\n  <img src=\"https://img.shields.io/badge/docs-ambiten.dev-22c55e?style=flat-square\" alt=\"documentation\" />\n</a> -->\n  <a href=\"https://github.com/AmbitenHQ/ambiten/stargazers\">\n    <img src=\"https://img.shields.io/github/stars/AmbitenHQ/ambiten?style=flat-square&color=1E88E5\" alt=\"GitHub stars\" />\n  </a>\n<img src=\"https://img.shields.io/badge/structured-logging-6366f1?style=flat-square\" alt=\"structured logging\" />\n<img src=\"https://img.shields.io/badge/context-aware-14b8a6?style=flat-square\" alt=\"context aware\" />\n</p>\n\n---\n\n## Overview\n\n`@ambiten/logger` provides the structured logging and telemetry layer for the Ambiten ecosystem.\n\nIt is designed for runtime-aware systems where logs are not merely developer output, but operational events attached to execution boundaries.\n\nThe logger can operate independently inside standard Node.js applications, APIs, workers, queues, GraphQL servers, and serverless environments. Inside the Ambiten runtime, it becomes context-aware and can automatically enrich log entries with request identifiers, tenant metadata, database targets, collection names, runtime metadata, and execution context.\n\nRather than treating logging as scattered console output, `@ambiten/logger` treats logs as structured runtime events that can move through transport pipelines, observability systems, metrics tracking, resilience layers, and production debugging workflows.\n\n## Installation\n\n```bash\nnpm install @ambiten/logger\n```\n\n## Quick Start\n\n```ts\nimport { createLogger, consoleTransport } from \"@ambiten/logger\";\n\nconst logger = createLogger({\n  level: \"info\",\n  transports: [\n    consoleTransport()\n  ]\n});\n\nlogger.info(\"Application started\");\n```\n\nStructured metadata can be attached directly to log entries.\n\n```ts\nlogger.error(\"Query failed\", {\n  tenantId: \"tenant-a\",\n  requestId: \"req-001\",\n  operation: \"findOne\"\n});\n```\n\nThe logger keeps metadata structured internally so transports can serialize, batch, forward, or persist logs without reconstructing runtime meaning from formatted strings.\n\n## What Ambiten Logger Is\n\nAmbiten Logger is not a console wrapper.\n\nIt is a structured telemetry pipeline for runtime execution.\n\nTraditional loggers focus on writing messages. Ambiten Logger focuses on preserving operational meaning as execution moves across requests, middleware, models, workers, transactions, queues, adapters, and distributed infrastructure.\n\nEvery emitted log becomes a structured runtime event that can participate in formatting, filtering, buffering, batching, metrics tracking, transport routing, and resilience handling.\n\n```text\nApplication Runtime\n        ↓\nStructured Log Entry\n        ↓\nTransport Pipeline\n        ↓\nObservability Destination\n```\n\n## Structured Logging\n\nAmbiten Logger preserves logs as structured runtime entries.\n\n```ts\nlogger.info(\"User created\", {\n  userId: \"usr_123\",\n  tenantId: \"tenant-a\",\n  route: \"/register\"\n});\n```\n\nA structured log entry can preserve fields such as timestamps, severity levels, runtime metadata, source information, execution context, and operational payloads.\n\nThis makes logs easier to index, search, filter, aggregate, and correlate inside systems such as Elasticsearch, Loki, OpenSearch, Datadog, CloudWatch, or custom telemetry pipelines.\n\nText output remains useful during local development, but the internal logging model remains structured.\n\n## Context-Aware Logging\n\nWhen used with the Ambiten runtime, the logger can inherit execution metadata from the active runtime context.\n\n```ts\nawait AmbitenContext.run(\n  {\n    tenantId: \"enterprise-a\",\n    requestId: \"req-992\"\n  },\n  async () => {\n    logger.info(\"Processing request\");\n  }\n);\n```\n\nLogs emitted during that execution boundary can automatically preserve runtime metadata such as tenant identity, request scope, database name, collection name, operation metadata, transaction state, and logger metadata.\n\nThis is especially valuable in multi-tenant systems and distributed applications where operational visibility depends on being able to reconstruct execution flow across layers.\n\n## Transport Pipeline\n\nAmbiten Logger separates log creation from log delivery.\n\nApplications emit structured runtime events. Transports decide where those events go.\n\n```ts\nimport {\n  createLogger,\n  consoleTransport,\n  createRotatingFileTransporter\n} from \"@ambiten/logger\";\n\nconst logger = createLogger({\n  json: true,\n  transports: [\n    consoleTransport(),\n    createRotatingFileTransporter({\n      filename: \"./logs/runtime.log\",\n      frequency: \"daily\",\n      backupCount: 7,\n      compress: true\n    })\n  ]\n});\n```\n\nThe transport layer is composable and can support console output, static files, rotating files, buffered delivery, asynchronous batching, HTTP ingestion, Loki, Elasticsearch, and custom infrastructure.\n\nBecause every transport receives normalized runtime entries, observability infrastructure can evolve without changing application logging logic.\n\n## Metrics and Runtime Signals\n\nThe logger can track operational metrics about the logging pipeline itself.\n\nMetrics can expose activity such as processed log volume, transport dispatches, successful writes, buffer flushes, file rotations, dropped logs, and transport errors.\n\n```ts\nconst logger = createLogger({\n  enableMetrics: {\n    enabled: true,\n    logInterval: 60_000\n  }\n});\n```\n\nThese metrics are not application logs. They describe the behavior of the logging infrastructure so teams can understand transport pressure, delivery failures, buffering behavior, and runtime throughput under production workloads.\n\n## Resilience\n\nProduction logging infrastructure can fail.\n\nRemote endpoints may become unavailable, networks may degrade, filesystems may stall, or observability backends may reject ingestion under pressure.\n\nAmbiten Logger supports resilience patterns that help isolate logging failures from application execution.\n\n```ts\nconst transport = createResilientTransporter(\n  createHttpTransport(process.env.LOG_INGEST_URL!)\n);\n```\n\nRetries and circuit breaker behavior help prevent unstable observability infrastructure from creating runtime instability.\n\nA transport failure should remain an operational signal, not become an application failure.\n\n## Production Usage\n\nIn production, structured logging should be treated as part of the operational architecture.\n\nA typical production setup uses JSON output, context-aware metadata, persistent or remote transports, graceful shutdown, and selective metrics tracking.\n\n```ts\nconst logger = createLogger({\n  level: \"info\",\n  json: true,\n  transports: [\n    createRotatingFileTransporter({\n      filename: \"./logs/runtime.log\",\n      frequency: \"daily\",\n      backupCount: 7,\n      compress: true\n    })\n  ],\n  enableMetrics: {\n    enabled: true,\n    logInterval: 60_000\n  }\n});\n```\n\nHigh-throughput systems should prefer buffering or asynchronous batching so logging does not introduce unnecessary filesystem or network pressure during sustained traffic.\n\n## Runtime Environments\n\n`@ambiten/logger` is designed to operate across different execution environments.\n\nIt can be used in local development, production APIs, background workers, queue processors, GraphQL systems, serverless functions, and containerized infrastructure.\n\nThe logging model remains consistent across environments because the logger operates on structured runtime entries before transport delivery occurs.\n\n## Relationship with Ambiten\n\n`@ambiten/logger` is part of the wider Ambiten runtime ecosystem.\n\nIt complements `@ambiten/core`, runtime instrumentation, adapter-driven execution, transaction-aware workflows, middleware pipelines, tenant-aware context propagation, and production observability tooling.\n\nThe package can still be used independently in non-Ambiten systems, but its full value appears when runtime context and structured execution metadata are available.\n\n## Documentation\n\nThe official Ambiten documentation includes guides for structured logging, context-aware telemetry, transport pipelines, production configuration, metrics tracking, resilience handling, testing, shutdown behavior, and observability integration.\n\nDocumentation:\n\nhttps://docs.ambiten.dev\n\n## Philosophy\n\n> Logs should describe runtime behavior, not just developer intent.\n\nAmbiten Logger exists to make operational behavior visible, structured, and traceable across modern runtime systems.\n\n## License\n\nMIT\n","readmeFilename":"README.md"}