chore: log uncaught exceptions
This commit is contained in:
parent
ff474ee507
commit
6f73606cfb
2 changed files with 13 additions and 2 deletions
|
|
@ -5,10 +5,17 @@ const options = require('./options')
|
||||||
const logger = new winston.Logger({
|
const logger = new winston.Logger({
|
||||||
level: options.logLevel,
|
level: options.logLevel,
|
||||||
transports: [
|
transports: [
|
||||||
new (winston.transports.Console)({ timestamp: true, colorize: true }),
|
new (winston.transports.Console)({
|
||||||
|
timestamp: true,
|
||||||
|
colorize: true,
|
||||||
|
handleExceptions: true,
|
||||||
|
humanReadableUnhandledException: true
|
||||||
|
}),
|
||||||
new Postgres({
|
new Postgres({
|
||||||
connectionString: options.postgresql,
|
connectionString: options.postgresql,
|
||||||
tableName: 'server_logs'
|
tableName: 'server_logs',
|
||||||
|
handleExceptions: true,
|
||||||
|
humanReadableUnhandledException: true
|
||||||
})
|
})
|
||||||
],
|
],
|
||||||
rewriters: [
|
rewriters: [
|
||||||
|
|
|
||||||
|
|
@ -36,4 +36,8 @@ module.exports = class CustomTransport extends Transport {
|
||||||
|
|
||||||
callback()
|
callback()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
logException (msg, meta, callback) {
|
||||||
|
this.log('error', msg, meta, callback)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue