Damien Cymbal wrote:
> Passing an actual logging reference into each component for logging
> just seems way too instrusive.
This is the way to do it.
In a recent life we created a base class that had pointers to the
configuration and logging systems that were used to set up logging for
all the components in the system.
By providing some tools to do this mostly transparently, it worked like
magic.
Mind you, not all classes inherited from the "Environment" class. It
required design jusdgement which classes needed them and which classes
clould use it's parent. Also, to determine if somthing logged or no was
done in such a way that it could be determined from configuration
"parameters" within the class itself, so you only paid for the cost of
logging when logging was turned on. On top of that you could set a
compile time parameter that would eliminate code altogether for logging
levels you did not want in your final code.
'tis very cool.
Anyway, getting back to you question - yep - intrusive - all objects
that need to log need to know how to get to the "logging and
configuration" environment.