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
|
1297
|
35 //----- (004BE386) --------------------------------------------------------
|
|
36 void __fastcall log_error(const char *pMessage)
|
|
37 {
|
|
38 const char *v1; // edi@1
|
|
39 FILE *f; // eax@1
|
|
40 FILE *v3; // esi@1
|
|
41
|
|
42 v1 = pMessage;
|
|
43 f = fopen("errorlog.txt", "a");
|
|
44 v3 = f;
|
|
45 if ( f )
|
|
46 {
|
|
47 fprintf(f, "%s\n", v1);
|
|
48 fclose(v3);
|
|
49 fflush(v3);
|
|
50 }
|
|
51 } |