File tree Expand file tree Collapse file tree 1 file changed +11
-3
lines changed Expand file tree Collapse file tree 1 file changed +11
-3
lines changed Original file line number Diff line number Diff line change @@ -16,6 +16,10 @@ constexpr auto EXCEPTION_CXX = 0xE06D7363L; // c++ throw ...
16
16
constexpr auto MS_VC_EXCEPTION = 0x406D1388L ; // thread renaming
17
17
constexpr auto RPC_UNAVAILABLE = 0x000006BAL ; // thrown in file dialog
18
18
19
+ // we limit the number of logged stacktraces since typically only the first exception is of any interest,
20
+ // and the following ones are either repetitions or consequences of the first exception which only make the log huge
21
+ int numMoreStacktraces = 5 ;
22
+
19
23
LONG WINAPI logWindowsException ( LPEXCEPTION_POINTERS pExInfo )
20
24
{
21
25
thread_local bool logging = false ;
@@ -70,10 +74,14 @@ LONG WINAPI logWindowsException( LPEXCEPTION_POINTERS pExInfo )
70
74
spdlog::info ( " Wide debug information: {}" , Utf16ToUtf8 ( std::wstring_view ( p, len ) ) );
71
75
}
72
76
else
73
- spdlog::critical ( " Windows exception {:#010x}" , pExceptionRecord->ExceptionCode );
77
+ spdlog::warn ( " Windows exception {:#010x}" , pExceptionRecord->ExceptionCode );
74
78
75
- spdlog::info ( " Windows exception stacktrace:\n {}" , getCurrentStacktrace () );
76
- printCurrentTimerBranch ();
79
+ if ( numMoreStacktraces > 0 )
80
+ {
81
+ --numMoreStacktraces;
82
+ spdlog::info ( " Windows exception stacktrace:\n {}" , getCurrentStacktrace () );
83
+ printCurrentTimerBranch ();
84
+ }
77
85
logging = false ;
78
86
return EXCEPTION_CONTINUE_SEARCH;
79
87
}
You can’t perform that action at this time.
0 commit comments