So i wrote my own log.Logger procedure implementation, which is very application specific and utilizes a few custom log levels that are effectively similar to a .Debug level and produce extra trace-level like output.
I however do not want those custom log levels to be enabled by setting the logger lowest enabled level to .Debug, I want to define a custom level beneath that, that is only used when explicitly enabling it. But there I stumbled upon the fact that log.Level.Debug is already the lowest possible level and a custom implementation cannot define their own levels below that:
Logger_Level :: enum uint {
Debug = 0,
Info = 10,
Warning = 20,
Error = 30,
Fatal = 40,
}
Where I was basically doing:
log.Level_Headers = {
0..<6 = "debug",
LOG_LEVEL_INBOUND = "inbound",
LOG_LEVEL_OUTBOUND = "outbound",
LOG_LEVEL_REACTOR_TRACE = "io",
10..<20 = "info",
20..<30 = "warn",
30..<40 = "error",
40..<50 = "fatal",
}
@(private) LOG_LEVEL_INBOUND :: log.Level(7)
@(private) LOG_LEVEL_OUTBOUND :: log.Level(8)
@(private) LOG_LEVEL_REACTOR_TRACE:: log.Level(9)
But this reserves custom levels that are already enabled when I initialize the logger with create_logger(lowest = .Debug), whereas I do not want this to happen, trace output should not be printed when a simple debug level is set.
I’m wondering if there’s any feasible workaround for this, or whether it feels like log.Level should be backed by an int instead of a uint, to define; well, negative log levels (if we do not want to break existing code relying on those numbers).