mirror of
https://github.com/vcmi/vcmi.git
synced 2025-03-19 21:10:12 +02:00
CLoggerBase: Use IvanSavenko's single-statement macro so that ct100 is not immediately destroyed
This commit is contained in:
parent
f81a0cb4b6
commit
d2b105f216
@ -172,9 +172,10 @@ private:
|
||||
/// Macros for tracing the control flow of the application conveniently. If the LOG_TRACE macro is used it should be
|
||||
/// the first statement in the function. Logging traces via this macro have almost no impact when the trace is disabled.
|
||||
///
|
||||
#define RAII_TRACE(logger, onEntry, onLeave) \
|
||||
if(logger->isTraceEnabled()) \
|
||||
std::unique_ptr<vstd::CTraceLogger> ctl00 = std::make_unique<vstd::CTraceLogger>(logger, onEntry, onLeave)
|
||||
#define RAII_TRACE(logger, onEntry, onLeave) \
|
||||
std::unique_ptr<vstd::CTraceLogger> ctl00 = logger->isTraceEnabled() ? \
|
||||
std::make_unique<vstd::CTraceLogger>(logger, onEntry, onLeave) : \
|
||||
std::unique_ptr<vstd::CTraceLogger>()
|
||||
|
||||
#define LOG_TRACE(logger) RAII_TRACE(logger, \
|
||||
boost::str(boost::format("Entering %s.") % BOOST_CURRENT_FUNCTION), \
|
||||
|
Loading…
x
Reference in New Issue
Block a user