I’ve just started to use Winston
so my issue must have a config problem so apologize in advance.
The problem in nutshell is that I can see the DEBUG logs neither in Console nor in file.
My Winston config
import * as winston from 'winston'
const logger: winston.Logger = winston.createLogger({
level: 'debug',
format: winston.format.combine(
//winston.format.colorize({ all: true }),
winston.format.timestamp({
format: 'YYYY-MM-DD hh:mm:ss.SSS A',
}),
winston.format.align(),
winston.format.printf((info) => `[${info.timestamp}] ${info.level}: ${info.message}`)
),
transports: [
new winston.transports.Console({
// level: process.env.LOG_LEVEL || 'debug',
level: 'debug',
format: winston.format.combine(winston.format.colorize())
}),
new winston.transports.File({
level: 'debug',
filename: 'app.log'
})
]
})
export default logger
The way how I use it in the code is
import logger from '../config/initLogger'
...
logger.debug(`Extraction starting [repoId=${repoId}, branches=${JSON.stringify(branches)}, path=${path}, progLangs=${progLangs}] ...`)
...
And all I can see is the INFO, WARN,… logs in Console or in file.
Any hint please? Thank you!