0
|
1 #include "Log.h"
|
|
2
|
|
3
|
|
4 #include <stdio.h>
|
|
5 #include <windows.h>
|
|
6 HANDLE hStdOut = nullptr;
|
|
7
|
|
8
|
|
9
|
|
10
|
|
11 void Log::Initialize()
|
|
12 {
|
|
13 if (AllocConsole())
|
|
14 hStdOut = GetStdHandle(STD_OUTPUT_HANDLE);
|
|
15 }
|
|
16
|
|
17
|
|
18 void Log::Warning(const wchar_t *pFormat, ...)
|
|
19 {
|
|
20 if (!hStdOut)
|
|
21 return;
|
|
22
|
|
23 va_list args;
|
|
24 wchar_t pMsg[8192];
|
|
25
|
|
26 va_start(args, pFormat);
|
|
27 vswprintf_s(pMsg, 8192, pFormat, args);
|
|
28 va_end(args);
|
|
29
|
|
30 DWORD w;
|
|
31 WriteConsole(hStdOut, pMsg, lstrlenW(pMsg), &w, nullptr);
|
|
32 WriteConsole(hStdOut, L"\r\n", 2, &w, nullptr);
|
|
33 }
|
|
34
|