getsentry / sentry-unity

Development of Sentry SDK for Unity
https://docs.sentry.io/platforms/unity/
MIT License
217 stars 52 forks source link

Split logging integration from error capturing #1608

Open bitsandfoxes opened 7 months ago

bitsandfoxes commented 7 months ago

We switched from hooking into Application.logMessageReceived to setting ourselves up as a loghandler via Debug.unitylogger.logHandler = this; This also means that we have to format the message ourselves which has a non-insignificant impact on performance

bitsandfoxes commented 6 months ago

We switched from Application.logMessageReceived to Debug.unitylogger.logHandler to get access to the actual exception object to hand that to the IL2CPP backend to provide line number support for caught and uncaught exceptions. We previously had our own string parsing functionality to turn the string stacktrace into a SentryStacktrace.

Maybe we can split this into two? Keep relying on the unitylogger for actual exceptions but set up the Application.logMessageReceived so that messages at least get a stacktrace (even without linenumbers for now). What do you think @munkiki7?

munkiki7 commented 6 months ago

@bitsandfoxes , if Debug.unitylogger.logHandler is only actually useful for getting the exception, and is heavier in performance, then sure, we can only use it in that one place.

WeiLingQiang commented 4 months ago

Is there any conclusion to this discussion? Can we use the method of monitoring Application.logMessageReceived instead of using Debug.unitylogger.logHandler = this;

Because there will be an extra line of useless information in the printed stack information: Sentry.Unity.Integrations.UnityLogHandlerIntegration:LogFormat(LogType, Object, String, Object[]) This is a very bad experience

bitsandfoxes commented 4 months ago

Not yet. But I'd really like to see this happen.

bitsandfoxes commented 3 weeks ago

We've not forgotten about this and have it on the roadmap.