Search Unity

How to invisble all the Debug.Logs

Discussion in 'Scripting' started by alexander, Apr 28, 2008.

  1. alexander

    alexander

    Joined:
    Mar 28, 2008
    Posts:
    180
    Hi,

    is there any command to inacticate all myDebug.Logs/Warnings/Errors in my scripts?
    Or have I got to delete them one after the other?

    Thanks
     
  2. AngryAnt

    AngryAnt

    Keyboard Operator

    Joined:
    Oct 25, 2005
    Posts:
    3,045
    You could define your own Debug class which would pass on calls to UnityEngine.Debug as long as a flag is ticked. Migrating to this class would be a simple search and replace.
     
  3. alexander

    alexander

    Joined:
    Mar 28, 2008
    Posts:
    180
    Hmm, sounds good.

    thx AngryAnt
     
  4. jashan

    jashan

    Joined:
    Mar 9, 2007
    Posts:
    3,307
    Hi Alexander,

    you might also consider a logging framework like log4net which gives you much more control on what gets logged, and what not. I've created a little wrapper so that this can easily be included and excluded by a simple search and replace in a single class file:

    http://forum.unity3d.com/viewtopic.php?t=8964

    You could probably also use this as a base for implementing the solution that AngryAnt has suggested (which does have advantages as you get the logging directly in the Unity Editor).

    Sunny regards,
    Jashan