Skip to content

Commit 40576a4

Browse files
authored
Merge pull request #3 from bitIO/log
chore(git): Setup commitizen
2 parents dc11498 + 48d3763 commit 40576a4

File tree

5 files changed

+5374
-124
lines changed

5 files changed

+5374
-124
lines changed

log.js

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
const winston = require('winston');
2+
3+
const { config } = winston;
4+
const logger = new (winston.Logger)({
5+
transports: [
6+
new (winston.transports.Console)({
7+
timestamp() {
8+
return Date.now();
9+
},
10+
formatter(options) {
11+
const color = config.colorize(options.level, options.level.toUpperCase());
12+
const message = options.message ? options.message : '';
13+
const meta = options.meta && Object.keys(options.meta).length ?
14+
`\n\t${JSON.stringify(options.meta)}` :
15+
'';
16+
return `[${options.timestamp()}][${color}] ${message} ${meta}`;
17+
},
18+
}),
19+
],
20+
});
21+
22+
module.exports = logger;

0 commit comments

Comments
 (0)