-
-
Notifications
You must be signed in to change notification settings - Fork 53
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: Stacktraces for Debug.LogError
events
#1965
Conversation
…etsentry/sentry-unity into feat/split-logging-integration
Debug.LogError
events
return frames; | ||
} | ||
|
||
private static SentryStackFrame ParseStackFrame(string stackFrameLine) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Personally I'd have preferred regex as that would have been easier to read to me. But AFAICT, the manual parsing seems correct
Co-authored-by: Ivan Dlugos <[email protected]>
LineNumber = lineNo == -1 ? null : lineNo | ||
}; | ||
} | ||
catch (Exception) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
concerning that we catch all and don't have any indication of what went wrong. debug logging at least?
Fixes #1608
This PR restores the functionality of capturing
Debug.LogError
and provides stacktraces in the resulting event.Before
After
Implementation Details
In this PR, we split the logging integration into two components:
UnityLogHandlerIntegration
UnityApplicationLoggingIntegration
The
UnityLogHandlerIntegration
hooks into the actual log handler and intercepts all logs. This allows us to access the exception object directly in case ofDebug.LogException
, but comes with notable limitations:string.Format
for each log captured as a breadcrumbApplication.OnMessageReceived
To address these limitations, we now implement both approaches:
UnityLogHandlerIntegration
UnityApplicationLoggingIntegration
LogErrors
viaUnityApplicationLoggingIntegration
We create a synthetic exception that parses the stringified stacktrace during capture and generates an event from it.
Known Limitations
Currently, we cannot provide line numbers for these issues. The
IL2CPPEventProcessor
requires an actually thrown exception to retrieve the necessary images and instruction addresses. In the case ofDebug.LogError
, no such exception exists.