Skip to content

Commit 577bf59

Browse files
committed
Update log transport
1 parent 16de6d2 commit 577bf59

File tree

1,420 files changed

+77537
-14
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,420 files changed

+77537
-14
lines changed

backend/src/util/logger.js

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,28 @@
1+
const os = require('os')
2+
13
const winston = require('winston')
2-
const Log2gelf = require('winston-log2gelf')
4+
const { WinstonGelfTransporter } = require('winston-gelf-transporter')
35

46
const transports = []
57

68
if (process.env.NODE_ENV !== 'test') {
79
transports.push(new winston.transports.File({ filename: 'debug.log' }))
810
}
911

10-
if (process.env.LOG_PORT && process.env.LOG_HOST) {
11-
transports.push(
12-
new Log2gelf({
13-
hostname: process.env.LOG_HOSTNAME || 'grappa2-backend',
14-
host: process.env.LOG_HOST,
15-
port: process.env.LOG_PORT,
16-
protocol: process.env.LOG_PROTOCOL || 'https',
17-
environment: process.env.NODE_ENV,
18-
protocolOptions: {
19-
path: process.env.LOG_PATH || '/gelf'
20-
}
21-
})
22-
)
12+
if (process.env.NODE_ENV === 'production') {
13+
transports.push(
14+
new WinstonGelfTransporter({
15+
handleExceptions: true,
16+
host: 'svm-116.cs.helsinki.fi',
17+
port: 9503,
18+
protocol: 'udp',
19+
hostName: os.hostname(),
20+
additional: {
21+
app: 'grappa',
22+
environment: 'production'
23+
}
24+
})
25+
)
2326
}
2427

2528
transports.push(new winston.transports.Console({ level: 'debug' }))

node_modules/.package-lock.json

Lines changed: 149 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)