Skip to content
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

Ability to colorize logs for well known frameworks/tools using Layouts #145

Open
federico-piazza opened this issue Dec 26, 2019 · 5 comments

Comments

@federico-piazza
Copy link

federico-piazza commented Dec 26, 2019

It would be great to have the ability colorize one line using different patterns.

For instance, spring boot has its own colorful template:
https://i.stack.imgur.com/S06Fz.png

It can be achieve using this template:

%d{yyyy-MMM-dd` HH:mm:ss.SSS} [%thread] %highlight(%-5level) %cyan(%logger{15}) - %msg %n

So, in addition to highlighters, it would be nice to add a log "layout". We could use multiple regex to have multiple colors inside the same line.

For example, these regex would apply for each line:

d{4}-d{2}-d{2} d{2}:d{2}:d{2}.d{3}      ----> grey color
INFO|ERROR|WARN|DEBUG                   ----> yellow
\s.*?:                                  ----> blue
@federico-piazza federico-piazza changed the title Ability to colorize logs for well known frameworks/tools Ability to colorize logs for well known frameworks/tools using Layouts Dec 26, 2019
@variar
Copy link
Owner

variar commented Dec 26, 2019

Thank for idea! Providing UI for editing such color "layout" seems to be complicated, but we can start by loading some text file crafted by hand.

@variar
Copy link
Owner

variar commented Sep 17, 2020

@federico-piazza creating separate highlighter groups (#190) with highlighters that apply colors only to matched part of the string (#189) should come close to this feature. And we can create some combinations and add them to klogg repository as importing highlighters from files is also supported (#173).

@federico-piazza
Copy link
Author

@variar awesome, you da man! Is this already available for download?

@variar
Copy link
Owner

variar commented Sep 18, 2020

@federico-piazza it should work in 20.9.0.664. Today I've found a bug with lines that has tab characters in them. Klogg expands tabs for display but not for pattern matching, so coloring is off by some columns. Might be not that easy to fix.

@xaljer
Copy link

xaljer commented Mar 1, 2021

In Vim syntax rules, there is a containedin= keyword which can follow ALL or a highlight group. This rule helps to embedded date (in different color) in a line of error, or notice words in a line of success, etc,. Highlight feature is like syntax in the Vim, which has more complete function as a code editor. May be we can learn some way from it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants