forked from elemetorkamatech2/storage-actions
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlogger.js
57 lines (41 loc) · 1.02 KB
/
logger.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
const pino = require('pino');
//const multistream = require('pino-multi-stream');
const fs = require('fs');
const logger = pino({
level: process.env.PINO_LOG_LEVEL || 'info',
formatters: {
bindings: (bindings) => {
return {
pid: bindings.pid,
host: bindings.hostname,
node_version: process.version,
};
},
level: (label) => {
return {
level: label.toUpperCase()
};
},
},
});
const fileTransports = pino.transport({
target: 'pino/file',
options: { destination: `${__dirname}/app.log` },
});
module.exports = pino(
{
level: process.env.PINO_LOG_LEVEL || 'info',
formatters: {
level: (label) => {
return { level: label.toUpperCase() };
},
},
prettyPrint: {
colorize: true,
levelFirst: true,
translateTime: 'yyyy-dd-mm, h:MM:ss TT',
},
timestamp: pino.stdTimeFunctions.isoTime,
},
fileTransports
);