iv-org / invidious

Invidious is an alternative front-end to YouTube
https://invidious.io
GNU Affero General Public License v3.0
16.42k stars 1.85k forks source link

Logger: Add color support for different log levels #4931

Closed Fijxu closed 1 week ago

Fijxu commented 1 month ago

Looks like this:

image

As I said in the code, this is useful when debugging things in Invidious. Having to find the type of error just by the name of the log level is not comfortable in my opinion.

Feel free to edit anything.

Fijxu commented 1 month ago

Done, I also added information about the NO_COLOR env variable. Color output also works on docker logs which is pretty neat.

image

unixfox commented 1 month ago

I don't think it's a good idea to have this as enabled by default.

I can see the color messing up with some existing log parsing system or something like that.

Fijxu commented 1 month ago

I can see the color messing up with some existing log parsing system or something like that.

Yeah you are right. This could break some automation system that does not support ANSI escape codes. It's better to leave it off by default and it would be great to point it on the wiki that this could be turned on (probably because most people would like to leave this setting on) if you want.

SamantazFox commented 1 week ago

I forgot to say thanks for your contribution :)