Hi, I've got a question.
I'm currently wrapping the LogManager class and the resulting ILog to
gain some custom behavior.
I would like to be able to flag certain logging events as "important" by
providing overloads of the Debug/Info/etc methods. The important events
would then get logged -- regardless of the configured level of the
logger. Do you have any advice on how to do this? This would be
possible, for example, if ILogger contained a "ForceLog" method (as
what's contained in Logger), but it doesn't.
One possibility would be to set a property on these special events, and
then use a PropertyFilter to detect the flag. But if I understand the
precedence of how filters work, this would require setting my root
logger level all the way down and then losing the ability to use the
"Is...Enabled" properties. I'd like to preserve that ability because
I'm doing some (relatively) expensive things prior to logging each
event.
Another possibility is to designate a node in the logger hierarchy for
such calls, but that would artificially divide the existing hierarchy:
the "important" events span all parts of the current hierarchy, and I'd
like to preserve the same hierarchical relationship of the important
events with the non-important events.
A third idea may be to store the true log level in a second place as a
property, and then to log %property{level} instead of %level, for
example. But that seems prone to error down the road.
Any other ideas? Getting at the ForceLog method seems like it might
require a lot of reimplementation.
Okay, thanks,
--Chris