sentry-unity icon indicating copy to clipboard operation
sentry-unity copied to clipboard

Split logging integration from error capturing

Open bitsandfoxes opened this issue 1 year ago • 5 comments

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 avatar Apr 05 '24 14:04 bitsandfoxes

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?

bitsandfoxes avatar May 13 '24 17:05 bitsandfoxes

@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.

munkiki7 avatar May 14 '24 13:05 munkiki7

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

WeiLingQiang avatar Jul 04 '24 03:07 WeiLingQiang

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

bitsandfoxes avatar Jul 04 '24 20:07 bitsandfoxes

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

bitsandfoxes avatar Oct 23 '24 13:10 bitsandfoxes