fblog icon indicating copy to clipboard operation
fblog copied to clipboard

Request: Support custom log levels

Open almostSouji opened this issue 1 year ago • 3 comments

(Potentially I'm just blind and this already exists)

[level_map] in the config is not able to achieve this (if i'm not missing something): DEV = "BLUE" displays as BLUE i'd want an option to print the DEV level/severity as DEV but highlighted in blue

if this is available in some of the formatting magic i'd appreciate some guidance, yet still this might be worth considering as part of the config file

almostSouji avatar Oct 09 '24 23:10 almostSouji

at the moment this is not a feature.

This is the relevant handlebar helper: https://github.com/brocode/fblog/blob/3eea0bc843f242ead47489ae89814592272dee0d/src/template.rs#L46

Maybe we need one that takes additional parameters 🤔

bomgar avatar Oct 10 '24 06:10 bomgar

Could you provide a few example log lines and a short explanation how they should be rendered?

bomgar avatar Oct 10 '24 06:10 bomgar

{"timestamp":"2024-10-11T22:54:43.113Z","level":"ABC","message":"log of the level abc"}
{"timestamp":"2024-10-11T22:54:43.113Z","level":"DEF","message":"log of the level def"}
{"timestamp":"2024-10-11T22:54:43.113Z","level":"DEF","message":"another def log"}
[log_levels]
abc = "cyan"
def = "yellow"

image

if i understand the readme correctly, currently only these are rendered in distinct colors:

trace
debug
info
warn
error
fatal

and everything else ("XYZ" in the readme example shows that) defaults to magenta? i'd like to customize that color

my real use case is that i have data frames for different packet types i'd like to distinctly color; doing it via the level seems like the more generally useful approach in the context of this project (though i am aware i am somewhat abusing the semantics of "level" to fit that use case)

almostSouji avatar Oct 12 '24 07:10 almostSouji