D.cs 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. using System;
  2. using UnityEngine;
  3. public class D {
  4. public static void Log(object __message) {
  5. if (!Debug.isDebugBuild) return;
  6. // Builds parameters
  7. System.Diagnostics.StackTrace t = new System.Diagnostics.StackTrace();
  8. string method = t.ToString().Split('\n')[1];
  9. method = method.Substring(method.IndexOf("at ") + 3);
  10. string currentFrame = Time.frameCount.ToString("0000000");
  11. string currentTime = (Time.realtimeSinceStartup * 1000).ToString("00000");
  12. // Finally, composes line
  13. string fullMessage = "[" + currentFrame + "@" + currentTime + "] " + method + " :: " + __message;
  14. //string fullMessage = "[" + currentFrame + ":" + currentTime + " | " + method + ": " + __message;
  15. // Writes to Unity console log and to normal log
  16. Debug.Log(fullMessage + "\n");
  17. System.Console.WriteLine(fullMessage);
  18. //Debug.Log("Flat Mesh Initialized (d)\n"); // UnityEngine.Debug.Log
  19. //System.Console.WriteLine("Flat Mesh Initialized");
  20. // Debug.isDebugBuild
  21. // http://docs.unity3d.com/Documentation/ScriptReference/Application.RegisterLogCallback.html
  22. // Port LoggingFramework:
  23. // http://forum.unity3d.com/threads/38720-Debug.Log-and-needless-spam
  24. }
  25. }