Skip to content

Colorize numeric log levels #320

@hogklint

Description

@hogklint

What would you like to be added:
Colorize numeric log levels with levelColor or similar, or at least allow the log to be printed anyway.
E.g. {"level": 30, "msg": "A message"}

Why is this needed:
Some log libraries use numeric log levels instead of the, in my experience, more usual debug, info, warn etc. When using the template function levelColor on numeric values it throws an error.

expanding template failed: template: log:1:70: executing "log" at <$d.level>: wrong type for value; expected string; got json.Number

It would be nice if levelColor could colorize numbers too, or at least allow the log line to be printed anyway.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions