HACKER Q&A
📣 hardlyknowwho

Where is log level ALWAYS?


The languages/packages I use don't natively support a way to log a message regardless of the current log level. First, is this common, and second, if it is, why is that? I've always felt like this is a gross oversight. For example, when my service starts, I would like it to ALWAYS log "Service started." I don't want that message to disappear when I go to production and the log level is set higher than that message deserves in a world defined by urgency. And I don't want to set it to WARN or ERROR.

Other extra-level logging methods I could make use of are: log.random (with argument(s) defining how random), log.context (everything the runtime knows at that point), and log.assert. These may be asking too much of a logging module, but on the other hand, if they lead to software that's easier to maintain, maybe they're worth bargaining for?

Anyway, I would love to hear your thoughts on how/why we ended up in a logging straitjacket of sorts. And yeah, I've defined ALWAYS as custom level before, and gotten it to work; I'm curious to know why it's not built in.


  👤 xk3 Accepted Answer ✓
probably because loglevel CRITICAL is good enough.

ALWAYS might not always be true. Can the message be logged if the hard drive and network failed?