Logging: enable the WinDebug callback using an env var.
Instead of hard-coding, add an env-var SG_WINDEBUG to enable the logging to the Windows debug stream.
This commit is contained in:
parent
c90ab3df5b
commit
c62c080a4b
@ -38,6 +38,7 @@
|
|||||||
|
|
||||||
#include <simgear/io/iostreams/sgstream.hxx>
|
#include <simgear/io/iostreams/sgstream.hxx>
|
||||||
#include <simgear/misc/sg_path.hxx>
|
#include <simgear/misc/sg_path.hxx>
|
||||||
|
#include <simgear/misc/strutils.hxx>
|
||||||
#include <simgear/timing/timestamp.hxx>
|
#include <simgear/timing/timestamp.hxx>
|
||||||
|
|
||||||
#if defined (SG_WINDOWS)
|
#if defined (SG_WINDOWS)
|
||||||
@ -387,9 +388,14 @@ public:
|
|||||||
|
|
||||||
m_callbacks.push_back(new StderrLogCallback(m_logClass, m_logPriority));
|
m_callbacks.push_back(new StderrLogCallback(m_logClass, m_logPriority));
|
||||||
m_consoleCallbacks.push_back(m_callbacks.back());
|
m_consoleCallbacks.push_back(m_callbacks.back());
|
||||||
#if defined (SG_WINDOWS) && !defined(NDEBUG)
|
|
||||||
m_callbacks.push_back(new WinDebugLogCallback(m_logClass, m_logPriority));
|
#if defined (SG_WINDOWS)
|
||||||
m_consoleCallbacks.push_back(m_callbacks.back());
|
const char* winDebugEnv = ::getenv("SG_WINDEBUG");
|
||||||
|
const bool b = winDebugEnv ? simgear::strutils::to_bool(std::string{winDebugEnv}) : false;
|
||||||
|
if (b) {
|
||||||
|
m_callbacks.push_back(new WinDebugLogCallback(m_logClass, m_logPriority));
|
||||||
|
m_consoleCallbacks.push_back(m_callbacks.back());
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user