-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathribbon.js
46 lines (38 loc) · 816 Bytes
/
ribbon.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
import Express from 'express';
import Moment from 'moment';
import DotEnv from 'dotenv';
import { createLogger, format, transports } from 'winston';
import Ribbon from './app/ribbon';
DotEnv.config();
const {
combine,
timestamp,
printf,
} = format;
const newFormat = printf((info) => {
const moment = Moment(info.timestamp).format('YYYY-MM-DD HH:mm');
return `[${moment}] ${info.level}: ${info.message}`;
});
const ribbon = new Ribbon(
Express,
Express(),
createLogger({
format: combine(
timestamp(),
newFormat,
),
transports: [
new transports.Console(),
new transports.File({ filename: 'combined.log' }),
],
levels: {
error: 0,
warn: 1,
info: 2,
plugin: 2,
verbose: 3,
debug: 4,
silly: 5,
},
}),
);