{"name":"@opentelemetry/winston-transport","version":"0.11.0","keywords":["transport","logging","nodejs","opentelemetry","winston"],"author":{"name":"OpenTelemetry Authors"},"license":"Apache-2.0","_id":"@opentelemetry/winston-transport@0.11.0","maintainers":[{"name":"bogdandrutu","email":"bogdandrutu@gmail.com"},{"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":"58e0706b8875ebf5501f545bbbe635050efdcb3b","tarball":"http://registry-npm.ywwl.com/@opentelemetry/winston-transport/download/@opentelemetry/winston-transport-0.11.0.tgz","fileCount":15,"integrity":"sha512-A7tku+4svJxYEtwMQaHLl9hEXNwpEf2tyUF1F9VYHK/rhhY5Wq/zUaSFW2iFBF1Wse5IxBang8C8k9ZTy41hwA==","signatures":[{"sig":"MEQCIGn/0f4x2ITfZ4GNjDiJJ4zfH6UDhXmuTJTM+4gWEWecAiBYZk3gs00NCkFAGaZStPwEjdY44qjD/wZVeUqrQRRCeA==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@opentelemetry%2fwinston-transport@0.11.0","provenance":{"predicateType":"https://slsa.dev/provenance/v0.2"}},"unpackedSize":30557,"size":8584,"noattachment":false,"key":"/@opentelemetry/winston-transport/-/@opentelemetry/winston-transport-0.11.0.tgz"},"main":"build/src/index.js","types":"build/src/index.d.ts","engines":{"node":"^18.19.0 || >=20.6.0"},"gitHead":"32abc4c3c01d0e78e10022c74b6805b06e0e1fe7","scripts":{"tdd":"npm run test -- --watch-extensions ts --watch","lint":"eslint . --ext .ts","test":"nyc mocha 'test/**/*.test.ts'","clean":"rimraf build/*","compile":"tsc -p .","lint:fix":"eslint . --ext .ts --fix","prewatch":"npm run precompile","prepublishOnly":"npm run compile","version:update":"node ../../scripts/version-update.js"},"_npmUser":{"name":"dyladan","email":"dyladan@gmail.com"},"repository":{"url":"git+https://github.com/open-telemetry/opentelemetry-js-contrib.git","type":"git"},"_npmVersion":"lerna/6.6.2/node@v18.20.7+x64 (linux)","description":"OpenTelemetry Transport for winston","directories":{},"_nodeVersion":"18.20.7","dependencies":{"winston-transport":"4.*","@opentelemetry/api-logs":"^0.200.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"nyc":"15.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.11.0_1742307488980_0.7142581158277157","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":1742307489206,"_cnpm_publish_time":1742307489206,"dist-tags":{"latest":"0.35.0"}}