{"_id":"@opentelemetry/instrumentation-console@0.7.0","bugs":{"url":"https://github.com/open-telemetry/opentelemetry-js-contrib/issues"},"dist":{"shasum":"00198af85b95824618010522f2ad39360ae0ae6f","tarball":"http://registry-npm.ywwl.com/@opentelemetry/instrumentation-console/download/@opentelemetry/instrumentation-console-0.7.0.tgz","fileCount":23,"integrity":"sha512-yeT0vDsSs3T68pd9YJgTTRvGeOqPFKnRxGtvl0SkenQpmfG6dA3Xh+VbVHV7BihEHPORAakrGXzJuLnJAvvSjg==","signatures":[{"sig":"MEQCIAnCriNJ2wyDzxOtvnzpX21/ha7Jvye3p9XHA+KSeQgbAiB5H3op0yVIOtuueOKhWS6ZeFgIdmTYTowCL8X4uIzJfA==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"},{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIH7mScIItCN611Ib+nEIYQ/wxPFIA2rEKxE3L9K32nlOAiEA0T7TyAKAWoML3/909LBtnx2xfzeNceHldUul2psSkfA="}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@opentelemetry%2finstrumentation-console@0.7.0","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":41828,"size":11137,"noattachment":false,"key":"/@opentelemetry/instrumentation-console/-/@opentelemetry/instrumentation-console-0.7.0.tgz"},"main":"./dist/index.cjs","name":"@opentelemetry/instrumentation-console","types":"./dist/index.d.cts","author":{"name":"OpenTelemetry Authors"},"engines":{"node":">=22.15.0"},"exports":{".":{"default":{"types":"./dist/index.d.mts","default":"./dist/index.mjs"},"require":{"types":"./dist/index.d.cts","default":"./dist/index.cjs"}}},"gitHead":"fc3b13eb41e9512fb0d769b431583f90b5ef8326","license":"Apache-2.0","scripts":{"tdd":"npm test -- --watch --watch-files \"**/*.ts\"","test":"nyc --no-clean mocha 'test/**/*.test.ts'","clean":"rimraf dist build","compile":"tsdown","lint:readme":"node ../../scripts/lint-readme.js","prepublishOnly":"npm run compile","version:update":"node ../../scripts/version-update.js","compile:with-dependencies":"nx run-many -t compile -p @opentelemetry/instrumentation-console"},"version":"0.7.0","_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"2776c27a-7828-4570-bc79-a7705d0721d7"}},"homepage":"https://github.com/open-telemetry/opentelemetry-js-contrib/tree/main/packages/instrumentation-console#readme","keywords":["console","instrumentation","logging","nodejs","opentelemetry","tracing"],"repository":{"url":"git+https://github.com/open-telemetry/opentelemetry-js-contrib.git","type":"git","directory":"packages/instrumentation-console"},"_npmVersion":"lerna/9.0.7/node@v24.22.2+x64 (linux)","description":"OpenTelemetry instrumentation for Node.js `console`","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"}],"_nodeVersion":"24.22.2","dependencies":{"@opentelemetry/instrumentation":"^0.301.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"@opentelemetry/api":"^1.10.0","@opentelemetry/sdk-logs":"^3.0.0","@opentelemetry/sdk-trace":"^3.0.0","@opentelemetry/context-async-hooks":"^3.0.0"},"peerDependencies":{"@opentelemetry/api":"^1.10.0"},"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/instrumentation-console_0.7.0_1793914592891_0.36816044437384066"},"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 `>=22.15.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":1793914592997,"_cnpm_publish_time":1793914592997,"dist-tags":{"latest":"0.7.0"}}