Console logging is not colorized.
See original GitHub issueI’m trying to colorize the console output and it’s not working. The output is all the same (white) color. I’m on 3.0.0-rc1.
const winston = require('winston');
const logLevels = {
levels: {
error: 0,
warn: 1,
info: 2,
http: 3,
sql: 4,
debug: 5
},
colors: {
error: "red",
warn: "darkred",
info: "black",
http: "green",
sql: "blue",
debug: "gray"
}
};
winston.addColors(logLevels);
const logger = winston.createLogger({...});
logger.add(new winston.transports.Console({colorize: true}));
I also tried the suggestion here but that’s not working either:
logger.add(new winston.transports.Console({format: winston.format.combine(formatter, winston.format.colorize())}));
Thanks, Alvaro
Issue Analytics
- State:
- Created 6 years ago
- Reactions:3
- Comments:22 (1 by maintainers)
Top Results From Across the Web
Colorful Console Message | SamanthaMing.com
Put this in your browser console console.log('%cHello', 'color: green; background: yellow; ... The text before the directive will not be affected.
Read more >google chrome - Colors in JavaScript console - Stack Overflow
Older versions of Chrome do not allow you to get console.log() s to show in a specific color programmatically, but calling console.error() will...
Read more >How to Log to the Console in Color - Baeldung
In this article, we'll see how to add color to our logs for consoles such as the Visual Studio Code terminal, Linux, and...
Read more >How to Add Colors in JavaScript Console Log Output?
We can add CSS styles to console log output with the %c tag. For instance, we can write: console.log('%c hello world ', 'background:...
Read more >How to Enable Color in Spring Boot Console Log
On most systems color coding works automatically. However if you are using a Mac terminal, you will find that no color coding is...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I was able to get it partially working using the documentation for logform.
Not sure how to handle dumping the JSON arguments.
Update here is what I worked out:
started winston and also got console without colors… i was using next transport defining code:
after reading this thread i did like this:
and got no difference. so i changed position of colorize format to 1st and got colors working