-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy path3_Logging.cpp
More file actions
63 lines (48 loc) · 1.99 KB
/
3_Logging.cpp
File metadata and controls
63 lines (48 loc) · 1.99 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
//Project: ErrLib
//Author: MSDN.WhiteKnight (https://github.com/MSDN-WhiteKnight)
//*** ErrLib logging example ***
#include <stdio.h>
#include <tchar.h>
#include "ErrLib.h"
void func1(){
throw std::exception();
}
void func(){
func1();
}
int _tmain(int argc, _TCHAR* argv[])
{
ErrLib_Initialize();
//set custom log file path
ErrLib_SetLogFilePath(L"d:\\error.log");
//configure output to use message box instead of stderr (console)
ErrLib_SetParameter(ERRLIB_OUTPUT_STDERR,FALSE);
ErrLib_SetParameter(ERRLIB_OUTPUT_MBOX,TRUE);
__try
{
func();
}
ERRLIB_CATCH_ALL
{
ErrLib_LogExceptionInfo(ErrLib_Except_GetCode(),ErrLib_Except_GetMessage(),ErrLib_Except_GetStackTrace(),TRUE);
}
return 0;
}
/*
*** Message box output: ***
Exception 0xe06d7363: C++ exception was not handled in user code
***************************
*** Log file output: ***
2018.07.09 14:52 - Exception 0xe06d7363: C++ exception was not handled in user code
in KERNELBASE.dll!RaiseException (C:\Windows\syswow64\KERNELBASE.dll; address: 0x7657c54f)
in MSVCR110D.dll!CxxThrowException (C:\Windows\system32\MSVCR110D.dll; address: 0x5553b198)
in ConsoleApplication1.exe!func1 + 0x44 (d:\projects\consoleapplication1\consoleapplication1.cpp; line: 11;)
in ConsoleApplication1.exe!func + 0x23 (d:\projects\consoleapplication1\consoleapplication1.cpp; line: 15;)
in ConsoleApplication1.exe!wmain + 0x9d (d:\projects\consoleapplication1\consoleapplication1.cpp; line: 27;)
in ConsoleApplication1.exe!__tmainCRTStartup + 0x199 (f:\dd\vctools\crt_bld\self_x86\crt\src\crtexe.c; line: 533;)
in ConsoleApplication1.exe!wmainCRTStartup + 0x0d (f:\dd\vctools\crt_bld\self_x86\crt\src\crtexe.c; line: 377;)
in kernel32.dll!BaseThreadInitThunk (C:\Windows\syswow64\kernel32.dll; address: 0x74af343d)
in ntdll.dll!RtlInitializeExceptionChain (C:\Windows\SysWOW64\ntdll.dll; address: 0x770c9832)
in ntdll.dll!RtlInitializeExceptionChain (C:\Windows\SysWOW64\ntdll.dll; address: 0x770c9805)
***************************
*/