Can I Debug.Log() on Android without all the callstack spam?

Can I Debug.Log() on Android without all the callstack spam?

I get this:

I/Unity   ( 1908): Serialized file length: 754 bytes.
I/Unity   ( 1908): UnityEngine.Debug:Internal_Log(Int32, String, Object)
I/Unity   ( 1908): UnityEngine.Debug:Log(Object)
I/Unity   ( 1908): SerializeTest:Test() (at Z:\Pong\Devel2010\Src\UnityGames\BhvrDemo\BinarySerialization\Assets\Script\SerializeTest.cs:64)
I/Unity   ( 1908): UnityEngine.Events.InvokableCall:Invoke(Object[])
I/Unity   ( 1908): UnityEngine.Events.InvokableCallList:Invoke(Object[])
I/Unity   ( 1908): UnityEngine.Events.UnityEventBase:Invoke(Object[])
I/Unity   ( 1908): UnityEngine.Events.UnityEvent:Invoke()
I/Unity   ( 1908): UnityEngine.UI.Button:Press() (at C:\BuildAgent\work\d63dfc6385190b60\Extensions\guisystem\guisystem\UI\Core\Button.cs:36)
I/Unity   ( 1908): UnityEngine.UI.Button:OnPointerClick(PointerEventData) (at C:\BuildAgent\work\d63dfc6385190b60\Extensions\guisystem\guisystem\UI\Core\Button.cs:45)
I/Unity   ( 1908): UnityEngine.EventSystems.ExecuteEvents:Execute(IPointerClickHandler, BaseEventData) (at C:\BuildAgent\work\d63dfc6385190b60\Extensions\guisystem\guisystem\EventSystem\ExecuteEvents.cs:52)
I/Unity   ( 1908): UnityEngine.EventSystems.ExecuteEvents:Execute(GameObject, BaseEventData, EventFunction`1) (at C:\BuildAgent\work\d63dfc6385190b6

but I would like this:
I/Unity   ( 1908): Serialized file length: 754 bytes.


Answer 1:

Yes, you can now. If you accept that stack traces also disappear from Debug.LogWarning() and Debug.LogError().

Just do this at startup:

// We do not want stack traces for all log statements. (Exceptions logged
// with Debug.LogException will still have stack traces though.):
Application.stackTraceLogType = StackTraceLogType.None;

Answer 2:

I don’t believe so. The best one can do is filter the logcat.

I discovered that a feature to toggle this behavior has been suggested in Unity Feedback, but it’s over 3 years old. 🙁

Answer 3:

I found this effective, rather than using Debug.Log I wrote directly to the Log.v android method. This also means you can use your own tag, for easy filtering.

    Log = new AndroidJavaObject("android.util.Log");
    Log.CallStatic<int>("v", TAG, message);