コード例 #1
0
 public static LogObject GetInstance()
 {
     if (!_initialized)
     {
         _instance    = SingletonManager.AddComponent <LogObject> ();
         _initialized = true;
     }
     return(_instance);
 }
コード例 #2
0
        private static void log(object owner, string name, object[] values)
        {
            string logStr = GetDebugString(owner, name, values);

            if (UnityEngine.Application.platform == RuntimePlatform.WindowsEditor ||
                UnityEngine.Application.platform == RuntimePlatform.OSXEditor)
            {
                if (name == WARN)
                {
                    Debug.LogWarning(logStr);
                }
                else if (name == ERROR)
                {
                    Debug.LogError(logStr);
                }
                else if (name == FATAL)
                {
                    Debug.LogError(logStr);
                }
                else
                {
                    Debug.Log(logStr);
                }
            }


            if (showInApp)
            {
                LogObject.GetInstance().logStr += logStr + "\n";
            }

            if (_persistentDataPath == "")
            {
                try
                {
                    _persistentDataPath = ApplicationUtils.GetProcessDirectory();
                }
                catch (Exception e)
                {
                    Debug.LogError(e);
                }
            }

            if (_persistentDataPath != "")
            {
                try
                {
                    string fileName = _persistentDataPath + "/" + name + ".log";

                    FileUtils.AppendTextToFile(logStr + "\n", fileName);
                }
                catch (Exception e)
                {
                    Debug.LogError(e);
                }
            }
        }
コード例 #3
0
ファイル: Log.cs プロジェクト: Argamente/Unknow
 public static LogObject GetInstance ()
 {
     if (!_initialized)
     {
         _instance = SingletonManager.AddComponent<LogObject> ();
         _initialized = true;
     }
     return _instance;
 }