I am using sailsjs, and i want to integrate winston-sentry with it. I am having hard luck in adding meta data to sentry. My code looks below :
in config/log.js
var logger = new (winston.Logger)({
transports: [
new sentry({
level: 'error',
dsn: 'sentrydsn',
patchGlobal: true,
json: true,
globalTags: {
productVersion: "1.2"
}
})
]
});
module.exports.log = {
custom : logger
};
in the serverError.js
sails.log.error('Sending 500 ("Server Error") response', data, {
userInformation: {
os: "linux",
browser: "chrome",
}
});
I was able to solve this part. Instead of using winston-sentry
. I used raven middleware directly in http.js
. Make sure to add the order correctly, for me the order was:
order: [
'startRequestTimer',
'cookieParser',
'session',
'myRequestLogger',
'bodyParser',
'handleBodyParserError',
'compress',
'methodOverride',
'poweredBy',
'$custom',
'router',
'ravenRequestHandler',
'ravenErrorHandler',
'www',
'favicon',
'404',
'500'
]