From cac536fc804e3192fd98181dd5556d16f4fc5cb7 Mon Sep 17 00:00:00 2001 From: Thomas Goyne Date: Tue, 29 Jun 2010 23:08:42 +0000 Subject: [PATCH] On Windows, send debug logging to the debugger rather than stdout. Originally committed to SVN as r4642. --- aegisub/libaegisub/windows/log.cpp | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/aegisub/libaegisub/windows/log.cpp b/aegisub/libaegisub/windows/log.cpp index 7c0d8fdf9..1eea66b75 100644 --- a/aegisub/libaegisub/windows/log.cpp +++ b/aegisub/libaegisub/windows/log.cpp @@ -18,11 +18,15 @@ /// @brief Windows logging /// @ingroup libaegisub - +#ifndef LAGI_PRE #include #include #include +#define WIN32_LEAN_AND_MEAN +#include +#endif + #include "libaegisub/log.h" #include "libaegisub/util.h" @@ -34,11 +38,8 @@ void EmitSTDOUT::log(SinkMessage *sm) { time_t time = sm->tv.tv_sec; localtime_s(&tmtime, &time); -// tmtime.tm_year+1900, -// tmtime.tm_mon, -// tmtime.tm_mday, - - printf("%c %02d:%02d:%02d %ld <%-25s> [%s:%s:%d] %.*s\n", + char buff[1024]; + _snprintf_s(buff, _TRUNCATE, "%c %02d:%02d:%02d %ld <%-25s> [%s:%s:%d] %.*s\n", Severity_ID[sm->severity], tmtime.tm_hour, tmtime.tm_min, @@ -50,6 +51,7 @@ void EmitSTDOUT::log(SinkMessage *sm) { sm->line, sm->len, sm->message); + OutputDebugStringA(buff); } } // namespace log } // namespace agi