Use STD_ERROR_HANDLE since SG_LOG uses stderr stream
Fixed spacing, cleaned up uneccessary #ifdef's
This commit is contained in:
parent
daa10503e6
commit
d0e31c5cf5
@ -227,20 +227,19 @@ public:
|
|||||||
#if defined (SG_WINDOWS)
|
#if defined (SG_WINDOWS)
|
||||||
// Check for stream redirection, has to be done before we call
|
// Check for stream redirection, has to be done before we call
|
||||||
// Attach / AllocConsole
|
// Attach / AllocConsole
|
||||||
const bool isFile = (GetFileType(GetStdHandle(STD_OUTPUT_HANDLE)) == FILE_TYPE_DISK); // Redirect to file?
|
const bool isFile = (GetFileType(GetStdHandle(STD_ERROR_HANDLE)) == FILE_TYPE_DISK); // Redirect to file?
|
||||||
if (AttachConsole(ATTACH_PARENT_PROCESS) == 0) {
|
if (AttachConsole(ATTACH_PARENT_PROCESS) == 0) {
|
||||||
// attach failed, don't install the callback
|
// attach failed, don't install the callback
|
||||||
addStderr = false;
|
addStderr = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!isFile) {
|
||||||
|
// No - OK! now set streams to attached console
|
||||||
|
freopen("conout$", "w", stdout);
|
||||||
|
freopen("conout$", "w", stderr);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
if (addStderr) {
|
if (addStderr) {
|
||||||
#if defined (SG_WINDOWS)
|
|
||||||
if (!isFile) {
|
|
||||||
// No - OK! now set streams to attached console
|
|
||||||
freopen("conout$", "w", stdout);
|
|
||||||
freopen("conout$", "w", stderr);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
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());
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user