{"name":"@opentelemetry/winston-transport","version":"0.16.2","keywords":["transport","logging","nodejs","opentelemetry","winston"],"author":{"name":"OpenTelemetry Authors"},"license":"Apache-2.0","_id":"@opentelemetry/winston-transport@0.16.2","maintainers":[{"name":"dyladan","email":"dyladan@gmail.com"},{"name":"pichlermarc","email":"marc.pichler@dynatrace.com"}],"homepage":"https://github.com/open-telemetry/opentelemetry-js-contrib/tree/main/packages/winston-transport#readme","bugs":{"url":"https://github.com/open-telemetry/opentelemetry-js-contrib/issues"},"dist":{"shasum":"c71a2a841af58ef08ce1061798e4314dc2c16a1b","tarball":"http://registry-npm.ywwl.com/@opentelemetry/winston-transport/download/@opentelemetry/winston-transport-0.16.2.tgz","fileCount":15,"integrity":"sha512-LKGwLU8/EIJQB1HsbT94YmvFrE1btjCJh+04CC/bxtAUTKy3TYLjEN5E6N8YBdi/d2t9vAGiNMNFKB1uVZMCUQ==","signatures":[{"sig":"MEYCIQDFN/0S8qje0XUeTmeqXz17JrGNhddIbPxAdayfukI92gIhAMsb+PfZFUxO+KXfoMV8Vb7Fuf2xA0q/ZQCF4UcXtZEo","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@opentelemetry%2fwinston-transport@0.16.2","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":31273,"size":8787,"noattachment":false,"key":"/@opentelemetry/winston-transport/-/@opentelemetry/winston-transport-0.16.2.tgz"},"main":"build/src/index.js","types":"build/src/index.d.ts","engines":{"node":"^18.19.0 || >=20.6.0"},"gitHead":"5a5918fd4f9f16b14c9ef4d3de08ab98c20e5b46","scripts":{"tdd":"npm run test -- --watch-extensions ts --watch","lint":"eslint . --ext=ts,js,mjs","test":"nyc mocha 'test/**/*.test.ts'","clean":"rimraf build/*","compile":"tsc -p .","lint:fix":"eslint . --ext=ts,js,mjs --fix","prepublishOnly":"npm run compile","version:update":"node ../../scripts/version-update.js","compile:with-dependencies":"nx run-many -t compile -p @opentelemetry/winston-transport"},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:44e6ec25-25b6-4e08-9c1c-a7604802d1bf"}},"repository":{"url":"git+https://github.com/open-telemetry/opentelemetry-js-contrib.git","type":"git","directory":"packages/winston-transport"},"_npmVersion":"lerna/9.0.0/node@v24.9.0+x64 (linux)","description":"OpenTelemetry Transport for winston","directories":{},"_nodeVersion":"24.9.0","dependencies":{"winston-transport":"4.*","@opentelemetry/api-logs":"^0.205.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"nyc":"17.1.0","sinon":"15.2.0","rimraf":"5.0.10","typescript":"5.0.4","@types/node":"18.18.14","@types/mocha":"10.0.10","@types/sinon":"17.0.4","@types/triple-beam":"1.3.5"},"_npmOperationalInternal":{"tmp":"tmp/winston-transport_0.16.2_1759174872014_0.19333966142145265","host":"s3://npm-registry-packages-npm-production"},"readme":"# OpenTelemetry transport for winston\n\n[![NPM Published Version][npm-img]][npm-url]\n[![Apache License][license-image]][license-image]\n\nThis module provides a Transport for [`winston`](https://www.npmjs.com/package/winston) module to send Winston logging to the OpenTelemetry Logging SDK.\n\nCompatible with OpenTelemetry JS API and SDK `1.0+`.\n\n## Installation\n\n```bash\nnpm install --save @opentelemetry/winston-transport\n```\n\n## Usage\n\nThis package exports the Winston transport class that is used to send records to the\nOpenTelemetry Logs SDK. It can be used directly when configuring a Winston logger. If using\n[`@opentelemetry/instrumenation-winston`](https://github.com/open-telemetry/opentelemetry-js-contrib/tree/main/packages/instrumentation-winston)\npackage there is no need to instantiate the transport as the instrumentation will take care of that.\nFor example:\n\n```js\nconst logsAPI = require('@opentelemetry/api-logs');\nconst {\n    LoggerProvider,\n    SimpleLogRecordProcessor,\n    ConsoleLogRecordExporter,\n} = require('@opentelemetry/sdk-logs');\nconst { OpenTelemetryTransportV3 } = require('@opentelemetry/winston-transport');\nconst winston = require('winston');\n\n\n// To start a logger, you first need to initialize the Logger provider.\n// And add a processor to export log record.\nconst loggerProvider = new LoggerProvider({\n  processors: [\n    new SimpleLogRecordProcessor({ exporter: new ConsoleLogRecordExporter() })\n  ],\n});\nlogsAPI.logs.setGlobalLoggerProvider(loggerProvider);\n\nconst logger = winston.createLogger({\n  level: 'info',\n  transports: [\n    new winston.transports.Console(),\n    new OpenTelemetryTransportV3()\n  ]\n});\n```\n\n> [!IMPORTANT]\n> Logs will be duplicated if `@opentelemetry/winston-transport` is added as a transport in `winston` and `@opentelemetry/instrumentation-winston` is configured with `disableLogSending: false`.\n\n### Error handling\n\n`Error` instances assigned to the conventional `error` or `err` fields are\nemitted through the OpenTelemetry Logs API exception field. Instances assigned\nto other metadata fields, including errors nested in arrays or objects, are\nconverted to structured attributes containing their `name`, `message`, `stack`,\nand other own properties. Circular references in serialized error metadata are\nrepresented as `[Circular]`.\n\n### Supported versions\n\n- [`winston`](https://www.npmjs.com/package/winston) versions `>=3.0.0 <4`\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/winston-transport\n[npm-img]: https://badge.fury.io/js/%40opentelemetry%2Fwinston-transport.svg\n","publish_time":1759174872239,"_cnpm_publish_time":1759174872239,"dist-tags":{"latest":"0.35.0"}}