Skip to content

Instantly share code, notes, and snippets.

@takashicompany
Created March 3, 2014 14:58
Show Gist options
  • Save takashicompany/9326753 to your computer and use it in GitHub Desktop.
Save takashicompany/9326753 to your computer and use it in GitHub Desktop.
Sample for Application.RegisterLogCallback (Unity)
void Awake ()
{
Application.RegisterLogCallback(LogCallBackHandler);
}
void LogCallBackHandler(string condition, string stackTrace, LogType type)
{
// condition :
// Debug.Log, Debug.LogWarning, Debug.LogError, Debug.LoeException Argument.
// stackTrace :
// UnityEngine.Debug:Log(Object)
// LogCallbaclkSample:OnGUI() (at Assets/LogCallbaclkSample.cs:45)
// LogType :
// LogType (enum).
System.Diagnostics.StackTrace systemStackTrace = new System.Diagnostics.StackTrace(true);
string systemStackTraceStr = systemStackTrace.ToString();
// System.Diagnostics.StackTrace.toString() :
// at LogCallbaclkSample.LogCallBackHandler(System.String condition, System.String stackTrace, LogType type) in /Users/*****/Temp/LogCallBackSample/Assets/LogCallbaclkSample.cs:line 30
// at UnityEngine.Application.CallLogCallback(System.String logString, System.String stackTrace, LogType type)
// at UnityEngine.Debug.Internal_Log(Int32 , System.String , UnityEngine.Object )
// at UnityEngine.Debug.Log(System.Object message)
// at LogCallbaclkSample.OnGUI() in /Users/*****/Temp/LogCallBackSample/Assets/LogCallbaclkSample.cs:line 57
SetLogData(condition, stackTrace,systemStackTraceStr, type);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment