On Windows, send debug logging to the debugger rather than stdout.

Originally committed to SVN as r4642.
This commit is contained in:
Thomas Goyne 2010-06-29 23:08:42 +00:00
parent c0b22973fa
commit cac536fc80

View file

@ -18,11 +18,15 @@
/// @brief Windows logging /// @brief Windows logging
/// @ingroup libaegisub /// @ingroup libaegisub
#ifndef LAGI_PRE
#include <stdio.h> #include <stdio.h>
#include <time.h> #include <time.h>
#include <string.h> #include <string.h>
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#endif
#include "libaegisub/log.h" #include "libaegisub/log.h"
#include "libaegisub/util.h" #include "libaegisub/util.h"
@ -34,11 +38,8 @@ void EmitSTDOUT::log(SinkMessage *sm) {
time_t time = sm->tv.tv_sec; time_t time = sm->tv.tv_sec;
localtime_s(&tmtime, &time); localtime_s(&tmtime, &time);
// tmtime.tm_year+1900, char buff[1024];
// tmtime.tm_mon, _snprintf_s(buff, _TRUNCATE, "%c %02d:%02d:%02d %ld <%-25s> [%s:%s:%d] %.*s\n",
// tmtime.tm_mday,
printf("%c %02d:%02d:%02d %ld <%-25s> [%s:%s:%d] %.*s\n",
Severity_ID[sm->severity], Severity_ID[sm->severity],
tmtime.tm_hour, tmtime.tm_hour,
tmtime.tm_min, tmtime.tm_min,
@ -50,6 +51,7 @@ void EmitSTDOUT::log(SinkMessage *sm) {
sm->line, sm->line,
sm->len, sm->len,
sm->message); sm->message);
OutputDebugStringA(buff);
} }
} // namespace log } // namespace log
} // namespace agi } // namespace agi