-
Notifications
You must be signed in to change notification settings - Fork 1.8k
colorize (only with console transport) doest not work with custom format #1774
Copy link
Copy link
Open
Description
Please tell us about your environment:
winstonversion?-
winston@2 - [ x]
winston@3
-
node -voutputs: v10- Operating System? (Windows, macOS, or Linux) windows 7
- Language? (all | TypeScript X.X | ES6/7 | ES5 | Dart) javascript
What is the problem?
Problem with colorize()
`
const winston = require('winston');
const customLogFormat = winston.format.printf(info => {
return `${info.timestamp} [${info.module}] ${info.level}: ${info.message} `;
});
const logger = module.exports = winston.createLogger({
level: 'silly',
format: winston.format.combine(
winston.format.timestamp({
format: 'YYYY-MM-DD HH:mm:ss'
}),
winston.format.errors({ stack: true }),
winston.format.splat(),
customLogFormat
),
defaultMeta: { module: 'nomModule1' },
transports: [
new winston.transports.File({
filename: 'fileLog.log'
}),
new winston.transports.Console({
format: winston.format.colorize()
})
]
});
logger.debug({
message: 'myMessage',
a: 'a',
b: 'b'
});
`
What do you expect to happen instead?
Expected behavior: levels should be colored in console transport, but with the code above colorize() does not work and level are not colored...
Other information
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels