winston-sentry-dia
v0.1.1
Published
Winston transport for sentry
Downloads
1,478
Readme
winston-sentry-dia
A simple winston transport that logs dia.js errors to sentry.
This transport is for winston 3.x and uses the new @sentry/node
SDK.
Installation
npm install --save winston-sentry-dia
Usage
Follow the steps in sentry's docs to set up your node sdk. The transport doesn't set up the sentry SDK for you in case you want to make any of your own sentry calls outside of the context of winston.
Initialize the transport and tell winston about it like this:
const winston = require('winston');
const SentryTransportDia = require('winston-sentry-dia');
const Sentry = require('@sentry/node');
Sentry.init({
/* sentry init values */
});
module.exports = new winston.Logger({
transports: [
/* ... your other transports */
new SentryTransportDia({ Sentry }),
]
});
Logging behavior
Whenever an error with level fatal
or error
are logged with your winston logger that error will also be logged to sentry.