
You can also use something like:
Logger& l = get_logger("boost::new_interesting_library::error); l << "blah";
In other words:
1. It's possible to have one object for each log category, must like libcwd does. You don't have to index logger with category at all and there's no overhead at all. 2. At the same time you can get logger for specific program part and category using string key -- must like in Log4j and the clones.
I like this approach and I personally think that setting logging levels in any specific part of a program is a must. The reason (which might say bad things about how we write software!) is that in my experience different libraries have different levels of maturity and hence different levels of logging. e.g., library X is fairly mature and needs very little logging. library Y is semi-mature and needs reasonably verbose logging. library Z is brand new and should be logged exhaustively. Anything which uses a global approach would force all log statements to the highest common demoninator and would force everything to be extremely verbose. Furthermore, having the option to compile out logging statements means that people can leave a lot of logging hard coded into the code simply because there is no incentive to remove it. (Which everybody finds out when you enable logging again....) Cheers, Simon