
Eelis van der Weegen wrote:
John Torjo wrote:
Eelis van der Weegen wrote:
1. What is the fundamental reason that logs cannot be declared/defined with something as simple as boost::logging::log mylog ("mylog");
Note: you can actually do the above: it's called "Scoped Logs"
The existence of scoped logs doesn't really affect my question: Assuming that BOOST_DECLARE_LOG/BOOST_DEFINE_LOG have a good reason to exist (for example because logger objects cannot be used at namespace level), what is the fundamental reason that they have to be macro's? Why can't we get the normal non-macro syntax at namespace level without losing functionality?
It's because the implementation of BOOST_DECLARE/DEFINE_LOG might change in time. Right now, it's a function returning a static reference to a logger. However, in time, if I find something better, it will change.
Regarding string names -- while I do not dispute that some users may have a use for a runtime object identification system based on string names or other runtime identification values, I am convinced that such systems solve a completely different problem that in its core has nothing to do with logging. I therefore feel that a logging library should just work with normal C++ identifiers, variables, references, iterators, etc. Any nifty string mappings (and naming/query schemes) can always be built on top of that if needed.
There's nothing stopping from not using the string names, if you really don't wish it. Best, John -- John Torjo, Contributing editor, C/C++ Users Journal -- "Win32 GUI Generics" -- generics & GUI do mix, after all -- http://www.torjo.com/win32gui/surfaces.html - Sky's the limit! -- http://www.torjo.com/cb/ - Click, Build, Run!