ログへ調査用の行を残せるようにした

このコミットが含まれているのは:
routersys committed 2026-08-25 00:05:30 +09:00
1 親 4324ba458e
コミット a39be56b8c
2ファイル変更
+31 -13

検索条件に一致するファイルはありません

+30 -13
ファイルの表示
@@ -10,6 +10,23 @@ void SetLogHandle(LOG_HANDLE* handle) {
g_log = handle;
}
#ifdef DL_DEBUG_LOG
static void WriteTrace(const wchar_t* text) {
static wchar_t logPath[MAX_PATH] = {};
if (!logPath[0]) {
wchar_t dir[MAX_PATH] = {};
if (GetTempPathW(MAX_PATH, dir))
_snwprintf_s(logPath, _TRUNCATE, L"%sDockLayout.log", dir);
}
if (!logPath[0]) return;
FILE* f = nullptr;
if (_wfopen_s(&f, logPath, L"a+, ccs=UTF-8") == 0 && f) {
fwprintf(f, L"%s\n", text);
fclose(f);
}
}
#endif
void LogF(const wchar_t* fmt, ...) {
wchar_t buf[1024];
va_list ap; va_start(ap, fmt);
@@ -17,19 +34,19 @@ void LogF(const wchar_t* fmt, ...) {
va_end(ap);
if (g_log) g_log->log(g_log, buf);
#ifdef DL_DEBUG_LOG
static wchar_t logPath[MAX_PATH] = {};
if (!logPath[0]) {
wchar_t dir[MAX_PATH] = {};
if (GetTempPathW(MAX_PATH, dir))
_snwprintf_s(logPath, _TRUNCATE, L"%sDockLayout.log", dir);
}
if (logPath[0]) {
FILE* f = nullptr;
if (_wfopen_s(&f, logPath, L"a+, ccs=UTF-8") == 0 && f) {
fwprintf(f, L"%s\n", buf);
fclose(f);
}
}
WriteTrace(buf);
#endif
}
void LogTraceF(const wchar_t* fmt, ...) {
#ifdef DL_DEBUG_LOG
wchar_t buf[1024];
va_list ap; va_start(ap, fmt);
_vsnwprintf_s(buf, _TRUNCATE, fmt, ap);
va_end(ap);
WriteTrace(buf);
#else
(void)fmt;
#endif
}