New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Not possible to disable or override default colorizing #209
Comments
I'm not sure I understand, @twaan. The [39m is what terminates the colorization, so your line in the log file (and in my tests) appears to be the expected result. Am I missing something? |
I mean, logs files are colorized even when you don't specify it in the custom format. Like if it was enabled by default. Instead of colorizing the text as expected, my custom format is adding color delimiters around the old ones (thoses added by winston-daily-rotate-file I guess). As I can't add colors the comment section, imagine that [info] 2019-01-22 02:26:32 is in green. Additional delimiters are my wanted color. Just test my code, it should reproduce the same result. Thank you for your response. |
I've ran your code and I get the same result you do in your log file. Could you put a snippet of what you expect the log file to look like? Meaning, are you expecting your code to output a log file that looks like:
|
Because a picture is worth a thousand words, there you have. This is the expected result (screenshot from the console where it's work). Notice that only the level and the timestamp are colored in (the same) green : This is the output in the log file. The whole content is already colored, notice the port number colored in blue. The color delimiters are added by my custom format around the level and the timestamp as expected : |
Ok. I'm not clear as to what's happening here. When I run the code below (which, except for the import vs require, is essentially identical to what you've provided), I do not see the situation you describe. Test Code
ResultCan you try that small sample in a standalone application and see if you still see the issue? |
Okay I just found the reason. I'm using VSCode and it has a default colorization for logs files which causes conflict. That's why I have the expected result by using the command cat in the console, like you did. I would never have suspected such behavior from VSCode. Anyway, thank you for having took the time to help me. |
Hi everybody,
Thank you for making Winston even more powerful and easy to use.
I encountered a problem with the colorize feature. It seems to be enabled by default and it's not possible to disable it, or override it by passing a custom format. My logger below :
Result in my logs files :
As you see, I have a custom format which colorizes only the prefix and leaves the message without colors. It's work as expected with the Console transport, but in my logs files the colorize feature seems to be called twice. The whole content is in first colorized by the fileRotation transport (I guess) and the prefix is then colorized by my custom format (visibles characters surrounding the prefix).
Any advices ?
The text was updated successfully, but these errors were encountered: