Search Unity

Feature Request Custom debug logging with burst

Discussion in 'Burst' started by jdtec, Mar 24, 2021.

  1. jdtec

    jdtec

    Joined:
    Oct 25, 2017
    Posts:
    302
    Hi, I original posted this question at this link, I didn't realise that Burst had it's own forum now!

    https://forum.unity.com/threads/custom-debug-logging-with-burst.1080293/

    Mods - feel free to delete the old thread if appropriate, I don't mean to spam.

    Requests:

    1) Apply the black magic that makes Debug.Log support strings declared in the parameter list with Burst work with LogError and Assert using strings too.

    2) Support passing a FixedString as a parameter inline (without declaring outside the function call first) so I don't have to use two lines every time I log something.

    Workarounds:

    So far I can do this:
    Unity.Debug.Log ("inline string");

    I can override the unity logger as tertle helpfully suggested in the other thread which would let me do some string processing to decide what gets logged to the console, but it's not ideal.

    Also, unless I'm missing something Debug.LogError, Debug.Assert and friends aren't supported with inline strings in burst.

    I imagine you plan to do both these things eventually anyway, I mean, would you disagree with me that it's fairly basic to have the ability to do asserts and error logging without having to do these workarounds? I know I can declare the string outside the function call but this is really a quality of life thing for me with keeping the code more readable.

    I run in release build lots because the editor is damn slow otherwise, so I like seeing string errors rather than just a callstack that reveals the job but not the line number.

    I used to use a debugger lots but the ones I've tried with DOTS are cumbersome & crash/hang lots, unlike with monobehaviours were they work fine.

    And so I depend on debug logging quite a bit right now.
     
    Last edited: Mar 25, 2021
  2. sheredom

    sheredom

    Unity Technologies

    Joined:
    Jul 15, 2019
    Posts:
    300
    I'll file an issue to support this, I don't currently know where we are here!
     
    mbaker, laurentlavigne and jdtec like this.
  3. jdtec

    jdtec

    Joined:
    Oct 25, 2017
    Posts:
    302
    Thanks for replying @sheredom. It really would be great to have these things.
     
    sheredom likes this.