{"name":"@opentelemetry/instrumentation-console","version":"0.4.0","description":"OpenTelemetry instrumentation for Node.js `console`","main":"build/src/index.js","types":"build/src/index.d.ts","repository":{"type":"git","url":"git+https://github.com/open-telemetry/opentelemetry-js-contrib.git","directory":"packages/instrumentation-console"},"scripts":{"clean":"rimraf build/*","compile":"tsc -p .","compile:with-dependencies":"nx run-many -t compile -p @opentelemetry/instrumentation-console","lint:readme":"node ../../scripts/lint-readme.js","prepublishOnly":"npm run compile","tdd":"npm run test -- --watch-extensions ts --watch","test":"nyc --no-clean mocha 'test/**/*.test.ts'","version:update":"node ../../scripts/version-update.js"},"keywords":["console","instrumentation","logging","nodejs","opentelemetry","tracing"],"author":{"name":"OpenTelemetry Authors"},"license":"Apache-2.0","engines":{"node":"^18.19.0 || >=20.6.0"},"publishConfig":{"access":"public"},"peerDependencies":{"@opentelemetry/api":"^1.9.1"},"devDependencies":{"@opentelemetry/api":"^1.9.1","@opentelemetry/context-async-hooks":"^2.9.0","@opentelemetry/sdk-logs":"^0.222.0","@opentelemetry/sdk-trace":"^2.9.0"},"dependencies":{"@opentelemetry/api-logs":"^0.222.0","@opentelemetry/instrumentation":"^0.222.0"},"homepage":"https://github.com/open-telemetry/opentelemetry-js-contrib/tree/main/packages/instrumentation-console#readme","gitHead":"932fc967b142a8eb47d306fe92107b62962099f0","_id":"@opentelemetry/instrumentation-console@0.4.0","bugs":{"url":"https://github.com/open-telemetry/opentelemetry-js-contrib/issues"},"_nodeVersion":"24.19.0","_npmVersion":"lerna/9.0.7/node@v24.19.0+x64 (linux)","dist":{"integrity":"sha512-nFrzLlHry2ngfgrpIQi1FSJ/IxLj0z0V6xER4KBeQZ7BPtqjugcSh47LEhrA5y8tm0DvELnPkBETpy/qBiURiA==","shasum":"b12a4a089d595482423f3d0cf3b2d96e8628a7cc","tarball":"http://registry-npm.ywwl.com/@opentelemetry/instrumentation-console/download/@opentelemetry/instrumentation-console-0.4.0.tgz","fileCount":15,"unpackedSize":33788,"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@opentelemetry%2finstrumentation-console@0.4.0","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQD48DFOCrIcGhZ70GfoLUxfvxDJW/DgiNwV5lGvClrPZAIhANbyfU/BqilOYJYS6AlgCgbRIR7a36fwGLIv1W3TvXNE"}],"size":10225,"noattachment":false,"key":"/@opentelemetry/instrumentation-console/-/@opentelemetry/instrumentation-console-0.4.0.tgz"},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:2776c27a-7828-4570-bc79-a7705d0721d7"}},"directories":{},"maintainers":[{"name":"dyladan","email":"dyladan@gmail.com"},{"name":"pichlermarc","email":"marc.pichler@dynatrace.com"},{"name":"overbalance","email":"overbalancedev@proton.me"},{"name":"npmjs-account","email":"npmjs-account@opentelemetry.io"},{"name":"trentm","email":"trentm@gmail.com"},{"name":"martinkuba","email":"martin@martinkuba.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/instrumentation-console_0.4.0_1788208676786_0.9283114596798301"},"_hasShrinkwrap":false,"readme":"# OpenTelemetry Instrumentation for Node.js Console\n\n[![NPM Published Version][npm-img]][npm-url]\n[![Apache License][license-image]][license-image]\n\nThis module provides automatic instrumentation for the Node.js [`console`](https://nodejs.org/api/console.html) module, generating OpenTelemetry LogRecords for console method calls (`console.log`, `console.error`, `console.warn`, etc.).\n\n## Installation\n\n```bash\nnpm install @opentelemetry/instrumentation-console\n```\n\n## Supported Versions\n\n- Node.js `^18.19.0 || >=20.6.0`\n\n## Usage\n\n```javascript\nconst { NodeSDK } = require('@opentelemetry/sdk-node');\nconst { ConsoleInstrumentation } = require('@opentelemetry/instrumentation-console');\n\nconst sdk = new NodeSDK({\n  instrumentations: [new ConsoleInstrumentation()],\n});\nsdk.start();\n\n// Now console calls will generate LogRecords\nconsole.log('Hello, world!');    // severity: INFO\nconsole.warn('Watch out!');      // severity: WARN\nconsole.error('Something bad');  // severity: ERROR\n```\n\n## Console Methods Instrumented\n\n| Console Method   | Severity Number | Severity Text |\n| ---------------- | --------------- | ------------- |\n| `console.trace`  | TRACE           | trace         |\n| `console.debug`  | DEBUG           | debug         |\n| `console.log`    | INFO            | info          |\n| `console.info`   | INFO            | info          |\n| `console.warn`   | WARN            | warn          |\n| `console.error`  | ERROR           | error         |\n| `console.dir`    | INFO            | info          |\n\n## Configuration\n\n| Option                  | Type                  | Default | Description                                                        |\n| ----------------------- | --------------------- | ------- | ------------------------------------------------------------------ |\n| `logSeverity`           | `SeverityNumber`      | —       | Minimum severity level; only logs at or above this level are sent  |\n\n## Trace Context Correlation\n\nWhen a console method is called within an active span context, the emitted\nLogRecord is associated with that context. The OpenTelemetry Logs SDK uses this\nto populate the LogRecord's `spanContext` (trace ID, span ID, and trace flags),\nso exported log records can be correlated with their originating trace.\n\n## Important: Infinite Loop Prevention\n\nThis instrumentation requires `@opentelemetry/api >= 1.9.1`. Starting from that version, the `DiagConsoleLogger` saves references to the original `console` methods at module load time, so internal OTel diagnostic logging bypasses the instrumentation and avoids infinite loops.\n\nAdditionally, this instrumentation includes a re-entrancy guard to prevent loops from exporters that write to the console (e.g., `ConsoleLogRecordExporter`).\n\n> **Note:** Avoid using `ConsoleLogRecordExporter` or `ConsoleSpanExporter` together with this instrumentation in production. Use network-based exporters (e.g., OTLP) instead.\n\n## Useful links\n\n- For more information on OpenTelemetry, visit: <https://opentelemetry.io/>\n- For more about OpenTelemetry JavaScript: <https://github.com/open-telemetry/opentelemetry-js>\n- For help or feedback on this project, join us in [GitHub Discussions][discussions-url]\n\n## License\n\nApache 2.0 - See [LICENSE][license-url] for more information.\n\n[discussions-url]: https://github.com/open-telemetry/opentelemetry-js/discussions\n[license-url]: https://github.com/open-telemetry/opentelemetry-js-contrib/blob/main/LICENSE\n[license-image]: https://img.shields.io/badge/license-Apache_2.0-green.svg?style=flat\n[npm-url]: https://www.npmjs.com/package/@opentelemetry/instrumentation-console\n[npm-img]: https://badge.fury.io/js/%40opentelemetry%2Finstrumentation-console.svg\n","publish_time":1788208676912,"_cnpm_publish_time":1788208676912,"dist-tags":{"latest":"0.7.0"}}