bat
bat copied to clipboard
colorize lines in logs differently depending on importance
Thanks for the work you put into bat
.
I was considering using tail -f
and bat
to colorize the log of a running program.
In many logs there are keywords indicating the importance of a line. For example INFO
, WARNING
, ERROR
, CRITICAL
, DEBUG
.
It would be useful to have the lines colored differently so that errors could be easily spotted.
Would you be interested in supporting this feature?
Thanks for the feedback. We had a short discussion on this at https://github.com/sharkdp/bat/issues/1605#issuecomment-813601215, but it should be possible to cater for both styles - log level word vs full line - with some color scheme customization if we tweak the log syntax to support it.
Vim has a very nice syntax highlighting plugin with the following rules: https://github.com/MTDL9/vim-log-highlighting/blob/master/syntax/log.vim
Is it possible to integrate similar rules in bat?
Here is how my log looks when I use bat:
And here are the same lines of log in Vim: