|
Boost : |
From: Andy Schweitzer (a_schweitzer_at_[hidden])
Date: 2005-08-14 21:04:29
Is there a way to pass log levels in a variable? The following code
doesn't compile:
void SomeClass::Dump(boost::logging::level_type eLevel,
boost::logging::logger& rLog)
{
BOOST_SCOPEDLOGL(rLog, eLevel)
<< "Some Msg" << m_iSomeMemberVariable << endl;
}
Compiler says: "error C2039: 'eLevel' : is not a member of
'boost::logging::level'"
I think the issue is that the levels are all const ints.
This is kind of important in our application. We have lots of code that
knows nothing about the environment, either the logs or the levels, and
needs to be compiled into different places, so it can't have the log or
the log level compiled in. I suppose we could change this code to return
a string and do the actual logging where the level and log are known at
compile time. But that would rule out "structural" drop in replacement.
So far no problems passing the log itself around, but haven't tested
extensively.
Thanks,
Andrew
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk