@@ -692,7 +692,7 @@ TSynLogFamily = class
692692 fNoEnvironmentVariable: boolean;
693693 { $endif OSWINDOWS}
694694 { $ifndef NOEXCEPTIONINTERCEPT}
695- fHandleExceptions: boolean;
695+ fHandleExceptions, fNoLibraryException : boolean;
696696 fOnBeforeException: TOnBeforeException;
697697 { $endif NOEXCEPTIONINTERCEPT}
698698 fAutoFlushTimeOut: cardinal;
@@ -798,6 +798,10 @@ TSynLogFamily = class
798798 // to this flag
799799 property ExceptionIgnoreCurrentThread: boolean
800800 index tiExceptionIgnore read GetCurrentThreadFlag write SetCurrentThreadFlag;
801+ // / set true will log exceptions only from the main executable, not from library
802+ // - will follow IsMainExecutable() result
803+ property NoLibraryException: boolean
804+ read fNoLibraryException write fNoLibraryException;
801805 // / allow to temporarly avoid logging in the current thread
802806 // - won't affect exceptions logging, as one would expect for safety reasons
803807 // - after setting true to this property, should eventually be reset to false:
@@ -6490,7 +6494,11 @@ procedure SynLogException(const Ctxt: TSynLogExceptionContext);
64906494 exit; // disabled for this thread (avoid nested call)
64916495 log := HandleExceptionFamily.Add;
64926496 if log = nil then
6493- exit;
6497+ exit;
6498+ if log.fFamily.NoLibraryException and
6499+ (Ctxt.EAddr <> 0 ) and
6500+ not IsMainExecutable(pointer(Ctxt.EAddr)) then // fast guess
6501+ exit;
64946502 thrdnam := CurrentThreadNameShort;
64956503 log.LockAndDisableExceptions; // ignore result = tiTemporaryDisable flag
64966504 try
0 commit comments