mirror of
https://github.com/iptv-org/epg.git
synced 2025-05-10 00:50:09 -04:00
Update logger.js
This commit is contained in:
parent
25293f8be0
commit
67b9ca2af0
1 changed files with 7 additions and 36 deletions
|
@ -1,42 +1,13 @@
|
||||||
const { createLogger, format, transports, addColors } = require('winston')
|
const { Signale } = require('signale')
|
||||||
const { combine, timestamp, printf } = format
|
|
||||||
|
|
||||||
const consoleFormat = ({ level, message, timestamp }) => {
|
const options = {}
|
||||||
if (typeof message === 'object') return JSON.stringify(message)
|
|
||||||
return message
|
|
||||||
}
|
|
||||||
|
|
||||||
const config = {
|
const logger = new Signale(options)
|
||||||
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 t = [
|
logger.config({
|
||||||
new transports.Console({
|
displayLabel: false,
|
||||||
format: format.combine(format.printf(consoleFormat))
|
displayScope: false,
|
||||||
|
displayBadge: false
|
||||||
})
|
})
|
||||||
]
|
|
||||||
|
|
||||||
const logger = createLogger({
|
|
||||||
transports: t,
|
|
||||||
levels: config.levels,
|
|
||||||
level: 'verbose'
|
|
||||||
})
|
|
||||||
|
|
||||||
addColors(config.colors)
|
|
||||||
|
|
||||||
module.exports = logger
|
module.exports = logger
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue