{"name":"@opentelemetry/instrumentation-console","version":"0.5.0","keywords":["console","instrumentation","logging","nodejs","opentelemetry","tracing"],"author":{"name":"OpenTelemetry Authors"},"license":"Apache-2.0","_id":"@opentelemetry/instrumentation-console@0.5.0","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"}],"homepage":"https://github.com/open-telemetry/opentelemetry-js-contrib/tree/main/packages/instrumentation-console#readme","bugs":{"url":"https://github.com/open-telemetry/opentelemetry-js-contrib/issues"},"dist":{"shasum":"65ef8843c10aba0b8106a5ef5a430b9b87f06c2e","tarball":"http://registry-npm.ywwl.com/@opentelemetry/instrumentation-console/download/@opentelemetry/instrumentation-console-0.5.0.tgz","fileCount":15,"integrity":"sha512-3YLQ7ZLGaQwyjnyS6KK3vYZxMlcEHHF5lsBVGbFMa7VvFh01JlB8H6en24HQbCOf8ORTA+4LA68KqDrIaBdHhw==","signatures":[{"sig":"MEQCIBqehcr2Nlw+lgM4t6YtfF42r7wDD/uxFES03guQj3FzAiANP+CyDuTukH3ifHIRj+SvvdnOx2Xn7iXQfIdayp8wIA==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"},{"sig":"MEYCIQDS8RJnOYDtsFwPm3Vg4et7gWyoA4IBHzXrqFq1g/008AIhALlFK3Rtm99A49p+2H11xBvzB7cKTRFfVqOga2a4psRP","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@opentelemetry%2finstrumentation-console@0.5.0","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":33788,"size":10222,"noattachment":false,"key":"/@opentelemetry/instrumentation-console/-/@opentelemetry/instrumentation-console-0.5.0.tgz"},"main":"build/src/index.js","types":"build/src/index.d.ts","engines":{"node":"^18.19.0 || >=20.6.0"},"gitHead":"cc263ac4e94320402ac3afe50d50eb00905e1bb8","scripts":{"tdd":"npm run test -- --watch-extensions ts --watch","test":"nyc --no-clean mocha 'test/**/*.test.ts'","clean":"rimraf build/*","compile":"tsc -p .","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"},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"2776c27a-7828-4570-bc79-a7705d0721d7"}},"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.21.0+x64 (linux)","description":"OpenTelemetry instrumentation for Node.js `console`","directories":{},"_nodeVersion":"24.21.0","dependencies":{"@opentelemetry/api-logs":"^0.223.0","@opentelemetry/instrumentation":"^0.223.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"@opentelemetry/api":"^1.9.1","@opentelemetry/sdk-logs":"^0.223.0","@opentelemetry/sdk-trace":"^2.9.0","@opentelemetry/context-async-hooks":"^2.9.0"},"peerDependencies":{"@opentelemetry/api":"^1.9.1"},"_npmOperationalInternal":{"tmp":"tmp/instrumentation-console_0.5.0_1791300101327_0.03600142086248348","host":"s3://npm-registry-packages-npm-production"},"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":1791300101414,"_cnpm_publish_time":1791300101414,"dist-tags":{"latest":"0.7.0"}}