Encapsulated Debug.Log Stacktrace reduction

Hello there, both in my hobby project and my project at work we have encapsulated Debug.Log/ Debug.LogError etc. in a seperate class to have better control over what and how we Log information, furthermore we added the System.Diagnostics.Conditonal Attribute to all methods in case we want to disable logging entirely.
This however causes the effect that:

  • The logged stacktrace includes the method calls inside the class that encapsulates Debug.Log
  • Doubleclicking the log will jump to the final method that called Debug.Log

Sadly compiling the logger class in its own libary is not a possibility because of the Conditonal Attribute.

Therefore I decided to make a feature request for an extra overload for all Debug.Log methods accepting an int which should then exlcude the last X method stacktraces, which obviously should also cause the double click to jump to the script that called the encapsulating class.

For example:

[Error]: An Error occured.
UnityEngine.Debug:LogError (object,UnityEngine.Object)
EoE.Runtime.Tools.DLogger:Log (string,UnityEngine.Object,EoE.Runtime.Enums.LogLevel) (at Assets/Scripts/Runtime/Tools/DLogger.cs:151)
EoE.Runtime.Tools.DLogger:Log (object,EoE.Runtime.Enums.LogLevel) (at Assets/Scripts/Runtime/Tools/DLogger.cs:39)
EoE.Runtime.MonoBehaviours.CameraControllers.AnchoredCameraController:Awake () (at Assets/Scripts/Runtime/MonoBehaviours/CameraControllers/AnchoredCameraController.cs:43)

Instead when calling the new overload with Debug.LogError(“An Error occured”, 2) it should then reduce the stacktrace to:

[Error]: An Error occured.
UnityEngine.Debug:LogError (object,UnityEngine.Object)
EoE.Runtime.MonoBehaviours.CameraControllers.AnchoredCameraController:Awake () (at Assets/Scripts/Runtime/MonoBehaviours/CameraControllers/AnchoredCameraController.cs:43)

Greetings,
Lucas

(post deleted by author)