Replace winston package with signale

This commit is contained in:
Aleksandr Statciuk 2022-02-15 02:55:46 +03:00
parent 64899ef9f6
commit 72cbe4741b
3 changed files with 386 additions and 502 deletions

841
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -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"
}
}

View File

@ -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))
logger.config({
displayLabel: false,
displayScope: false,
displayBadge: false
})
]
const logger = createLogger({
transports: t,
levels: config.levels,
level: 'verbose'
})
addColors(config.colors)
module.exports = logger