Ejemplo n.º 1
0
 static public int Log_s(IntPtr l)
 {
     try {
                     #if DEBUG
         var    method     = System.Reflection.MethodBase.GetCurrentMethod();
         string methodName = GetMethodName(method);
                     #if UNITY_5_5_OR_NEWER
         UnityEngine.Profiling.Profiler.BeginSample(methodName);
                     #else
         Profiler.BeginSample(methodName);
                     #endif
                     #endif
         System.Object[] a1;
         checkParams(l, 1, out a1);
         OzDebug.Log(a1);
         pushValue(l, true);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
             #if DEBUG
     finally {
                     #if UNITY_5_5_OR_NEWER
         UnityEngine.Profiling.Profiler.EndSample();
                     #else
         Profiler.EndSample();
                     #endif
     }
             #endif
 }
Ejemplo n.º 2
0
 static public int CreateInstance_s(IntPtr l)
 {
     try {
                     #if DEBUG
         var    method     = System.Reflection.MethodBase.GetCurrentMethod();
         string methodName = GetMethodName(method);
                     #if UNITY_5_5_OR_NEWER
         UnityEngine.Profiling.Profiler.BeginSample(methodName);
                     #else
         Profiler.BeginSample(methodName);
                     #endif
                     #endif
         OzDebug.CreateInstance();
         pushValue(l, true);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
             #if DEBUG
     finally {
                     #if UNITY_5_5_OR_NEWER
         UnityEngine.Profiling.Profiler.EndSample();
                     #else
         Profiler.EndSample();
                     #endif
     }
             #endif
 }
Ejemplo n.º 3
0
 static public void CreateInstance()
 {
     if (mInstance == null)
     {
         GameObject go = new GameObject("_OzDebug");
         mInstance = go.AddComponent <OzDebug>();
         DontDestroyOnLoad(go);
     }
 }
Ejemplo n.º 4
0
    protected static LoadedAssetBundle LoadManifest(string manifestAssetBundleName)
    {
        LoadedAssetBundle bundle = LoadAssetBundleInternal(manifestAssetBundleName, true, true, false);

        if (bundle == null)
        {
            OzDebug.Log("LoadManifest fail.");
        }
        return(bundle);
    }
Ejemplo n.º 5
0
    /// <summary>
    /// Prints the log.
    /// </summary>
    /// <param name="level">Level.</param>
    /// <param name="format">Format.</param>
    /// <param name="args">Arguments.</param>
    public static void PrintLog(LogSeverity level, string format, params object[] args)
    {
        if (string.IsNullOrEmpty(format))
        {
            return;
        }

#if DEVELOPMENT_BUILD
        if (level == LogSeverity.LogError)
        {
            OzDebug.Log(string.Format(format, args));
        }
#endif

        LogRecord(level, string.Format(format, args));
    }
Ejemplo n.º 6
0
    private static void _OnLogAction(SLua.Logger.Level level, string stackTrace)
    {
        if (level == SLua.Logger.Level.Error)
        {
            //_OnLogCallbackHandler("LuaScriptException", stackTrace, LogType.Error);
            if (IsInitialized)
            {
                string reason     = null;
                string callStacks = stackTrace;
                if (stackTrace.Contains("stack traceback:"))
                {
                    int stackLocation = stackTrace.IndexOf("stack traceback:");
                    if (stackLocation > 0)
                    {
                        reason     = stackTrace.Substring(0, stackLocation);
                        callStacks = stackTrace.Substring(stackLocation + 16).Replace(" [", " \n[");
                    }
                }
                _HandleException(LogSeverity.LogError, "LuaScriptException", reason, callStacks, true);
            }
        }

#if DEVELOPMENT_BUILD
        if (level == SLua.Logger.Level.Error)
        {
            OzDebug.Log(stackTrace);
        }
#endif
#if UNITY_EDITOR
        if (level == SLua.Logger.Level.Debug)
        {
            UnityEngine.Debug.Log(stackTrace);
        }
        else if (level == SLua.Logger.Level.Warning)
        {
            UnityEngine.Debug.LogWarning(stackTrace);
        }
        else if (level == SLua.Logger.Level.Error)
        {
            UnityEngine.Debug.LogError(stackTrace);
        }
#endif
    }