{"id":20767015,"url":"https://github.com/binded/winston-rollbar-transport","last_synced_at":"2025-03-11T18:51:26.819Z","repository":{"id":57398133,"uuid":"71675795","full_name":"binded/winston-rollbar-transport","owner":"binded","description":"A winston logger transport for Rollbar","archived":false,"fork":false,"pushed_at":"2016-10-23T03:01:14.000Z","size":7,"stargazers_count":0,"open_issues_count":1,"forks_count":1,"subscribers_count":9,"default_branch":"master","last_synced_at":"2025-01-18T06:28:13.072Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/binded.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-10-23T01:49:44.000Z","updated_at":"2016-10-23T09:52:46.000Z","dependencies_parsed_at":"2022-09-06T10:01:31.978Z","dependency_job_id":null,"html_url":"https://github.com/binded/winston-rollbar-transport","commit_stats":null,"previous_names":["blockai/winston-rollbar-transport"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/binded%2Fwinston-rollbar-transport","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/binded%2Fwinston-rollbar-transport/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/binded%2Fwinston-rollbar-transport/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/binded%2Fwinston-rollbar-transport/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/binded","download_url":"https://codeload.github.com/binded/winston-rollbar-transport/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243094608,"owners_count":20235531,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-17T11:27:17.011Z","updated_at":"2025-03-11T18:51:26.798Z","avatar_url":"https://github.com/binded.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# winston-rollbar-transport\n\n[![Build Status](https://travis-ci.org/blockai/winston-rollbar-transport.svg?branch=master)](https://travis-ci.org/blockai/winston-rollbar-transport)\n\nA [winston](https://github.com/winstonjs/winston) logger transport for\n[Rollbar](https://github.com/rollbar/node_rollbar).\n\n## Install\n\n```bash\nnpm install --save winston-rollbar-transport winston\n```\n\nRequires Node v6+\n\n## Usage\n\n```javascript\nimport winston from 'winston'\nimport RollbarTransport from 'winston-rollbar-transport'\n\nconst logger = new winston.Logger({\n  transports: [\n    new RollbarTransport({\n      // required\n      rollbarAccessToken: process.env.ROLLBAR_ACCESS_TOKEN,\n      rollbarConfig: {\n        // optional\n        // see https://github.com/rollbar/node_rollbar#configuration-reference\n      },\n      level: 'info', // log level. defaults to 'info'\n    }),\n  ],\n})\n\n// regular logging\nlogger.info('some message')\n\n// logging with custom metadata\nlogger.info('some message', {\n  // req and err are special keys, see below\n  somekey: 'somevalue',\n})\n\n// logging with request data\nlogger.info('some message', { req })\n\n// logging an error\n// Important: the second parameter is not optional (see below)\nlogger.error(err, { err })\n```\n\n### Error handling\n\nSince Winston log messages are converted to strings,\n`winston-rollbar-transport` will only see a string if `logger.error(new\nError())` is called and can't therefore report the exception propoerly\nto Rollbar with `rollbar.handleErrorWithPayloadData`.\n\nTherefore, to correctly report exceptions, use the `err` key on the meta\nfield in addition to the message. For example:\n\n```javascript\nlogger.error(err, { err })\n```\n\n### Using with console transport\n\nIf you are using this with the `console` transport, you might want to\ndisable printing the meta objects so that you don't see the whole\n`req` object when its set:\n\n```javacript\nnew winston.transports.Console({\n  prettyPrint: () =\u003e '', // disables printing the meta object\n})\n```\n\nSee [./test](./test) directory for usage examples.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbinded%2Fwinston-rollbar-transport","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbinded%2Fwinston-rollbar-transport","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbinded%2Fwinston-rollbar-transport/lists"}