I’m working on adding burst support for an existing debug logger that we have developed. I’d like to intercept Debug.Log messages from Burst compiled code, decorate the message, and pipe it through our logging system.
I’ve been able to listen for log messages emitted from burst compiled code but have been unable to prevent the default log message from showing up.
What I’ve discovered so far is that log messages emitted from burst compiled code:
- Don’t pass through Debug.unityLogger.logHandler - So implementing and assigning a custom ILogHandler implementation doesn’t help.
- Aren’t affected by Debug.unityLogger.logEnabled - Setting this to false only suppresses log messages from outside a burst context.
- Do trigger Application.logMessageReceivedThreaded events - This event triggers before the default message makes it to the console but there doesn’t appear to be a mechanism to stop the message from being logged.
I poked around the BurstRuntime and BurstCompilerService types. I see what looks like the outgoing method calls but no way to disable log messages from a burst context.
Is there a way to suppress Debug.Log messages from Burst compiled code?