Replace winston package with signale
This commit is contained in:
parent
64899ef9f6
commit
72cbe4741b
File diff suppressed because it is too large
Load Diff
|
@ -40,7 +40,7 @@
|
|||
"natural-orderby": "^2.0.3",
|
||||
"nedb-promises": "^5.0.2",
|
||||
"normalize-url": "^6.1.0",
|
||||
"transliteration": "^2.2.0",
|
||||
"winston": "^3.3.3"
|
||||
"signale": "^1.4.0",
|
||||
"transliteration": "^2.2.0"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,42 +1,13 @@
|
|||
const { createLogger, format, transports, addColors } = require('winston')
|
||||
const { combine, timestamp, printf } = format
|
||||
const { Signale } = require('signale')
|
||||
|
||||
const consoleFormat = ({ level, message, timestamp }) => {
|
||||
if (typeof message === 'object') return JSON.stringify(message)
|
||||
return message
|
||||
}
|
||||
const options = {}
|
||||
|
||||
const config = {
|
||||
levels: {
|
||||
error: 0,
|
||||
warn: 1,
|
||||
info: 2,
|
||||
failed: 3,
|
||||
success: 4,
|
||||
http: 5,
|
||||
verbose: 6,
|
||||
debug: 7,
|
||||
silly: 8
|
||||
},
|
||||
colors: {
|
||||
info: 'white',
|
||||
success: 'green',
|
||||
failed: 'red'
|
||||
}
|
||||
}
|
||||
const logger = new Signale(options)
|
||||
|
||||
const t = [
|
||||
new transports.Console({
|
||||
format: format.combine(format.printf(consoleFormat))
|
||||
})
|
||||
]
|
||||
|
||||
const logger = createLogger({
|
||||
transports: t,
|
||||
levels: config.levels,
|
||||
level: 'verbose'
|
||||
logger.config({
|
||||
displayLabel: false,
|
||||
displayScope: false,
|
||||
displayBadge: false
|
||||
})
|
||||
|
||||
addColors(config.colors)
|
||||
|
||||
module.exports = logger
|
||||
|
|
Loading…
Reference in New Issue