Log severity as a special field
Lassi Kortela 29 Dec 2020 20:52 UTC
SRFI 215 wisely constructs log entries from arbitrary key-value pairs.
The severity level is the only exception to this rule.
My intuition says it may not be that simple to work things out in a big
system such that severity is the only by which you'd like to filter logs
at compile time. And it may not be simple to have a universal severity
scale that is respected by every part of the program (including
third-party libraries).
If the main point of severity is to have a sliding scale on which
logging verbosity can be controlled at runtime, wouldn't it be equally
simple and more future-proof to let programmers add mixins to the log
callback to filter which entries are logged?
If the point is to enable compile-time macros that can leave verbose
messages off the build product altogether, could identifiers be used for
that purpose? It would enable finer-grained control than one global log
level.