import changes

This commit is contained in:
Emily 2020-10-17 12:17:05 +11:00
parent 0588d24882
commit 7e140d1ce8

View file

@ -1,7 +1,6 @@
const { createLogger, format, transports, addColors } = require("winston");
const { combine, timestamp, printf, colorize } = format;
const { createLogger, format, transports, addColors } = require('winston');
const fmt = printf(({ level, message, timestamp }) => {
const fmt = format.printf(({ level, message, timestamp }) => {
return '[' + timestamp + '] ' + level + ' ' + message;
});
@ -16,33 +15,33 @@ const customLevels = {
},
colours: {
debug: "black magentaBG",
cmd: "black whiteBG",
info: "black cyanBG",
ready: "black greenBG",
warn: "black yellowBG",
error: "black redBG"
debug: 'black magentaBG',
cmd: 'black whiteBG',
info: 'black cyanBG',
ready: 'black greenBG',
warn: 'black yellowBG',
error: 'black redBG'
}
};
const logger = createLogger({
levels: customLevels.levels,
level: "error",
format: combine(
timestamp({
format: "YYYY-MM-DD hh:mm:ss"
level: 'error',
format: format.combine(
format.timestamp({
format: 'YYYY-MM-DD hh:mm:ss'
}),
fmt
),
transports: [
new transports.Console({
level: "error",
format: combine(
timestamp({
format: "YYYY-MM-DD hh:mm:ss"
level: 'error',
format: format.combine(
format.timestamp({
format: 'YYYY-MM-DD hh:mm:ss'
}),
colorize(),
format.colorize(),
fmt
)
})