Search Unity

  1. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Question Any information about com.unity.logging ?

Discussion in '2022.2 Beta' started by Kichang-Kim, Nov 15, 2022.

  1. Kichang-Kim

    Kichang-Kim

    Joined:
    Oct 19, 2010
    Posts:
    1,005
    Hi. I found that latest Unity Transport package depends on "com.unity.logging" which seems to be Unity's official logging library.

    I used NLog for my project for years, but if com.unity.logging will be more Unity friendly, I want to replace my logging to it. But there is no information/forum for it.

    Any information for that?

    Thanks.
     
    bdovaz likes this.
  2. TreyK-47

    TreyK-47

    Unity Technologies

    Joined:
    Oct 22, 2019
    Posts:
    1,810
    Hello! Documentation about the logging package itself is available here. There's no documentation about the integration of logging in transport, because there is not really anything to document (no knobs to tune or anything; we just use the default logger if the package is installed).
     
    Kichang-Kim likes this.
  3. Kichang-Kim

    Kichang-Kim

    Joined:
    Oct 19, 2010
    Posts:
    1,005
    @TreyK-47 Thanks for reply. Is it safe to use com.unity.logging as main logging library for user project? or is it only internal library for Unity?
     
  4. TheRobWatling

    TheRobWatling

    Joined:
    Feb 18, 2013
    Posts:
    40
    This package looks to be heavily inspired by Serilog which is nice to see, I hope it's going to be supported for external developers and not just as an internal Unity package :D
     
  5. jura_wd

    jura_wd

    Joined:
    Jan 28, 2014
    Posts:
    32
    Yeah, it is not an internal one - feel free to use it
     
  6. Kichang-Kim

    Kichang-Kim

    Joined:
    Oct 19, 2010
    Posts:
    1,005
    @TreyK-47
    I can't find any dedicated forum for this package. so I post my question to this thread:

    1. Can I hook logging event by my own event method? (equivalent to Application.logMessageReceived. I think CustomSink can be used for this purpose, right?)
    2. Can I get Unity's internal log (like not handled exception log, shader error or any other internal log message without C# stacktrace) by using this? (Application.logMessageReceived can handle all of Unity's internal log)