0
|
1 #include "Log.h"
|
|
2
|
|
3 #include <stdio.h>
|
|
4 #include <windows.h>
|
1481
|
5
|
0
|
6 HANDLE hStdOut = nullptr;
|
|
7
|
|
8
|
|
9 void Log::Initialize()
|
|
10 {
|
|
11 if (AllocConsole())
|
|
12 hStdOut = GetStdHandle(STD_OUTPUT_HANDLE);
|
|
13 }
|
|
14
|
|
15
|
|
16 void Log::Warning(const wchar_t *pFormat, ...)
|
|
17 {
|
|
18 if (!hStdOut)
|
|
19 return;
|
|
20
|
|
21 va_list args;
|
1566
|
22 wchar_t pMsg[8192];
|
0
|
23
|
|
24 va_start(args, pFormat);
|
1566
|
25 vswprintf_s(pMsg, 8192, pFormat, args);
|
0
|
26 va_end(args);
|
|
27
|
1566
|
28 DWORD w;
|
|
29 WriteConsole(hStdOut, pMsg, lstrlenW(pMsg), &w, nullptr);
|
|
30 WriteConsole(hStdOut, L"\r\n", 2, &w, nullptr);
|
0
|
31 }
|
1297
|
32 //----- (004BE386) --------------------------------------------------------
|
|
33 void __fastcall log_error(const char *pMessage)
|
|
34 {
|
|
35 const char *v1; // edi@1
|
|
36 FILE *f; // eax@1
|
|
37 FILE *v3; // esi@1
|
|
38
|
|
39 v1 = pMessage;
|
|
40 f = fopen("errorlog.txt", "a");
|
|
41 v3 = f;
|
|
42 if ( f )
|
|
43 {
|
|
44 fprintf(f, "%s\n", v1);
|
|
45 fclose(v3);
|
|
46 fflush(v3);
|
|
47 }
|
|
48 } |