-
-
Couldn't load subscription status.
- Fork 57
feat: Structured Logging #2368
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
base: feat/bump-version6
Are you sure you want to change the base?
feat: Structured Logging #2368
Conversation
|
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.
It looks like a lot but I've split up the implementation of everything inside of OnLogMessageReceived into:
IsGettingDebouncedProcessException<- responsible for capturing exceptions via logs on WebGLProcessError<- responsible for creating events out of Debug.LogError when configuredProcessBreadcrumbs<- responsible for creating breadcrumbs out of logs
| private readonly IDiagnosticLogger? _logger; | ||
|
|
||
| public UnityErrorLogException(string logString, string logStackTrace, SentryOptions? options) | ||
| : base(logString) |
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.
This is fixing an actual bug where the .NET SDK would automatically add a breadcrumb for exceptions but the actual logmessage would be missing, causing a generic "Exception of type X was captured" breadcrumb.
| } | ||
|
|
||
| private void OnQuitting() | ||
| private void ProcessBreadcrumbs(string message, LogType logType) |
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.
This is the actual change in this file: Capture breadcrumbs only when not capturing structured logs or when explicitly opted in.
| if (_options.AutoSessionTracking) | ||
| { | ||
| _hub?.PauseSession(); | ||
| } | ||
| _hub?.FlushAsync(_sentryOptions?.ShutdownTimeout ?? TimeSpan.FromSeconds(1)).GetAwaiter().GetResult(); | ||
| _hub?.FlushAsync(_options.ShutdownTimeout).GetAwaiter().GetResult(); |
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.
There is a separate PR that cleans up the unreleated SessionTracking in the LogHandlerIntegration.
This PR adds support for
Structured Logging.Implementation Context
The tricky part is the separation between
UnityLogHandlerIntegrationandUnityApplicationLoggingIntegration.UnityLogHandlerIntegrationUnityApplicationLoggingIntegrationDebug.LogErrorWebGLResult