internal static void UpdateLogHandler() { if (unityLogHandler != null) { return; } unityLogHandler = Debug.unityLogger.logHandler; DefaultUnityLogger = new Logger(unityLogHandler); if (_log4NetLogHandler == null) { _log4NetLogHandler = new UnityDefaultLogHandler(); } Debug.unityLogger.logHandler = _log4NetLogHandler; LogLog.LogReceived += (source, args) => { var prefix = args?.LogLog.Prefix ?? "log4net: "; if (prefix.ToLower().Contains("warn")) { unityLogHandler.LogFormat(LogType.Warning, null, $"{prefix}{args?.LogLog?.Message}{(args?.LogLog?.Exception != null ? " Exception: " + args.LogLog.Exception.ToString() : "")}"); } else if (prefix.ToLower().Contains("error")) { unityLogHandler.LogFormat(LogType.Error, null, $"{prefix}{args?.LogLog?.Message}{(args?.LogLog?.Exception != null ? " Exception: " + args.LogLog.Exception.ToString() : "")}"); } else { unityLogHandler.LogFormat(LogType.Log, null, $"{prefix}{args?.LogLog?.Message}{(args?.LogLog?.Exception != null ? " Exception: " + args.LogLog.Exception.ToString() : "")}"); } }; }
public static void Debug(string format, params object[] args) { if (Application.isEditor) { UnityEngine.Debug.unityLogger.Log(string.Format(format, args)); } else { unityLogHandler.LogFormat(LogType.Log, null, format, args); } }
private static void Application_logMessageReceived(string condition, string stackTrace, LogType type) { if (LOG_TO_UNITY) { defaultLogHandler.LogFormat(LogType.Log, null, stackTrace); } if (type == LogType.Exception) { Debug.LogError(condition + Environment.NewLine + stackTrace, null); } }
private void LogError(string text) { if (_loopCheck) { return; } _loopCheck = true; _defaultHandler.LogFormat(LogType.Error, null, "{0}", text); NewEntry(text, Color.red); _loopCheck = false; }
//public MyFileLogHandler(Text outlawText, Text undertakerText) { // Debug.logger.logHandler = this; // this.outlawText = outlawText; // this.undertakerText= undertakerText; //} public void LogFormat(LogType logType, UnityEngine.Object context, string format, params object[] args) { var message = String.Format(format, args); if (message.StartsWith("Bob:")) { bobText.text = message; } else if (message.StartsWith("Elsa:")) { elsaText.text = message; } if (message.StartsWith("Outlaw:")) { outlawText.text = message; } else if (message.StartsWith("Undertaker:")) { undertakerText.text = message; } m_DefaultLogHandler.LogFormat(logType, context, format, args); }
public void LogFormat(LogType logType, UnityEngine.Object context, string format, params object[] args) { if (showLog) { defaultHandler.LogFormat(logType, context, format, args); } }
public void LogFormat(LogType logType, UnityEngine.Object context, string format, params object[] args) { switch (logType) { case LogType.Assert: case LogType.Error: case LogType.Exception: format = string.Format("[{0}][{1}]", DateTime.Now.ToString("hh:mm:ss"), logType) + format; defaultLoghandler.LogFormat(logType, context, format, args); break; default: log(logType, context, format, args); break; } }
public void LogFormat(LogType logType, UnityEngine.Object context, string format, params object[] args) { string timePrefix = string.Format("[{0}:{1}.{2}] : ", DateTime.Now.Hour, DateTime.Now.Minute, DateTime.Now.Second); switch (logType) { case LogType.Log: Console.Print(timePrefix + string.Format(format, args), LogColor); break; case LogType.Warning: Console.Warning(timePrefix + string.Format(format, args)); break; case LogType.Assert: Console.Error(timePrefix + "Failed Assertion!\n" + string.Format(format, args)); break; case LogType.Error: Console.Error(timePrefix + string.Format(format, args)); break; case LogType.Exception: Console.Error(timePrefix + "Unhandled Exception!\n" + string.Format(format, args)); break; } FallbackHandler.LogFormat(logType, context, format, args); }
public static int LogFormat(IntPtr l) { int result; try { ILogHandler logHandler = (ILogHandler)LuaObject.checkSelf(l); LogType logType; LuaObject.checkEnum <LogType>(l, 2, out logType); UnityEngine.Object context; LuaObject.checkType <UnityEngine.Object>(l, 3, out context); string format; LuaObject.checkType(l, 4, out format); object[] args; LuaObject.checkParams <object>(l, 5, out args); logHandler.LogFormat(logType, context, format, args); LuaObject.pushValue(l, true); result = 1; } catch (Exception e) { result = LuaObject.error(l, e); } return(result); }
public void LogFormat(LogType logType, UnityEngine.Object context, string format, params object[] args) { var logTime = DateTime.Now; var tempTimeSpaneStr = string.Format("{0:00}-{1:00} {2:00}:{3:00}:{4:00}.{5:000} | ", logTime.Month, logTime.Day, logTime.Hour, logTime.Minute, logTime.Second, logTime.Millisecond); _defaultLogHandler.LogFormat(logType, context, tempTimeSpaneStr + format, args); }
public void LogFormat(LogType logType, UnityEngine.Object context, string format, params object[] args) { if (logType == LogType.Log) { labelRenderer.AddTimedLabel(string.Format(format, args), LOG_DELAY); } original.LogFormat(logType, context, format, args); }
public void LogFormat(LogType logType, UnityEngine.Object context, string format, params object[] args) { if (logType == LogType.Error || logType == LogType.Assert || logType == LogType.Exception) { HasErrors = true; } inner.LogFormat(logType, context, format, args); }
public void LogFormat(LogType logType, UnityEngine.Object context, string format, params object[] args) { if (DebugLevel > 0) { m_StreamWriter.WriteLine(String.Format(format, args)); m_StreamWriter.Flush(); m_DefaultLogHandler.LogFormat(logType, context, format, args); } }
void ILogHandler.LogFormat(LogType logType, UnityEngine.Object context, string format, params object[] args) { originalLogHandler.LogFormat(logType, context, format, args); if (Application.isPlaying) { GameObject newLog = Instantiate <GameObject>(logTemplate, logTemplate.transform.parent); newLog.GetComponent <Text>().text = string.Format(format, args); otherLogs.Add(newLog); } }
public void LogFormat(LogType logType, UnityEngine.Object context, string format, params object[] args) { //m_StreamWriter.WriteLine ( String.Format (format, args) ); //m_StreamWriter.Flush (); m_DefaultLogHandler.LogFormat(logType, context, format, args); OnLogEvent(logType, context, format, args); //m_StreamWriter = new StreamWriter (); //m_StreamWriter. }
public void LogFormat(LogType logType, UnityEngine.Object context, string format, params object[] args) { string log = string.Format("[{0}][{1}] {2} ", DateTime.Now, logType.ToString(), format); // write stream m_streamWriter.WriteLine(String.Format(format, args)); m_streamWriter.Flush(); // write log m_logHandler.LogFormat(logType, context, log, args); }
void ILogHandler.LogFormat(LogType logType, UnityEngine.Object context, string format, params object[] args) { if (!EnableLog) { return; } m_StreamWriter.WriteLine(String.Format(format, args)); m_StreamWriter.Flush(); m_DefaultLogHandler.LogFormat(logType, context, format, args); }
public void LogFormat(LogType logType, Object context, string format, params object[] args) { var prefix = string.Format(format, args); for (int i = 0; i < DebugManager.DisableTags.Length; i++) { if (prefix.StartsWith(DebugManager.DisableTags[i])) { return; } } defaultLogHandler.LogFormat(logType, context, format, args); }
public void LogFormat(LogType logType, UnityEngine.Object context, string format, params object[] args) { #if !UNITY_EDITOR if (logType == LogType.Log || logType == LogType.Warning) { return; } #endif m_StreamWriter.WriteLine(String.Format(format, args)); m_StreamWriter.Flush(); m_DefaultLogHandler.LogFormat(logType, context, format, args); }
public void LogFormat(UnityLogType logType, UnityObject context, string format, object[] args) { if (m_HookedLogger == null) { throw new InvalidOperationException($"{nameof(ExportConfigurationLogHandler)} is not hooked into the logger. Logs can't be recorded."); } m_HookedLogger.LogFormat(logType, context, format, args); m_JournalData.RecordLogEvent(context, logType, string.Format(format, args)); if (logType == UnityLogType.Error) { m_FailureLogs = true; } }
public void LogFormat(LogType logType, UnityEngine.Object context, string format, params object[] args) { if (!m_MessageDialog.gameObject.activeInHierarchy) { m_MessageDialog.Show(logType.ToString(), String.Format(format, args)); } else { m_MessageDialog.AppendText(String.Format(format, args)); } // Pass on the message to the original logger so that it can be displayed on the console as well m_OriginalLogger.LogFormat(logType, context, format, args); }
public void LogFormat(LogType logType, UnityEngine.Object context, string format, params object[] args) { if (streamWriter == null) { streamWriter = NewLogWriter(); } streamWriter.WriteLine(string.Format("{0}\t{1}\t{2}", TimeTag.PadRight(10), logType.ToString().PadRight(10), string.Format(format, args))); streamWriter.Flush(); if (logCount++ >= logCountPerFile) { streamWriter.Close(); } defaultLogHandler.LogFormat(logType, context, format, args); }
public void LogFormat(LogType logType, UnityEngine.Object context, string format, params object[] args) { if ((_setting & LogSetting.PrefixFrame) != 0) { _bld.Append(Time.frameCount); _bld.Append(' '); } if ((_setting & LogSetting.PrefixTime) != 0) { _bld.AppendFormat("[{0}]", Time.time.ToString("F3")); _bld.Append(' '); } _bld.Append(": "); _bld.Append(format); _defaultHandler.LogFormat(logType, context, _bld.ToString(), args); _bld.Remove(0, _bld.Length); }
public void LogFormat(LogType logType, UnityEngine.Object context, string format, params object[] args) { if (logType.Equals(LogType.Error)) { streamWriterError.WriteLine(String.Format(format, args)); streamWriterError.Flush(); } else if (logType.Equals(LogType.Warning)) { streamWriterGen.WriteLine(String.Format(format, args)); streamWriterGen.Flush(); } else { streamWriterMain.WriteLine(String.Format(format, args)); streamWriterMain.Flush(); } defaultLogHandler.LogFormat(logType, context, format, args); }
public void LogFormat(LogType logType, UnityEngine.Object context, string format, params object[] args) { lock (_object) { string type = ""; switch (logType) { case LogType.Log: { type = "Step"; break; } case LogType.Warning: { type = "Warning"; break; } case LogType.Error: { type = "Error"; break; } default: { type = "Exception"; break; } } // Change format string newFormat = "{0}: " + type + ": {1}"; string dtNow = DateTime.Now.ToString("yyyy-MM-ddTHH:mm:ss.fffzzz"); int len = args.Length + 1; object[] tmpArgs = new object[2]; tmpArgs[0] = dtNow; tmpArgs[1] = args[0]; // only get first element of args m_StreamWriter.WriteLine(String.Format(newFormat, tmpArgs)); m_StreamWriter.Flush(); m_DefaultLogHandler.LogFormat(logType, context, newFormat, tmpArgs); } }
public void LogFormat(LogType logType, UObject context, string format, params object[] args) { switch (logType) { case LogType.Error: case LogType.Assert: case LogType.Exception: Record(new LogInfo(logType, context, string.Format(format, args), new StackTrace(1, true))); break; default: if (NonErrorLogHandler == null) { DebugEx.UnityLogHandler.LogFormat(logType, context, format, args); } else { NonErrorLogHandler.LogFormat(logType, context, format, args); } break; } }
public void LogFormat(LogType logType, UnityObject context, string format, params object[] args) { k_DefaultLogHandler.LogFormat(LogType.Log, m_Context, "Context: {0} ({1})", m_Context, AssetDatabase.GetAssetPath(m_Context)); k_DefaultLogHandler.LogFormat(logType, context, format, args); }
public void LogFormat(LogType logType, UnityEngine.Object context, String format, params Object[] args) { _log.Write(GetPrefix(logType), 0, format, args); _native.LogFormat(logType, context, format, args); }
public void LogFormat(LogType logType, Object context, string format, params object[] args) { // todo defaultLogHandler.LogFormat(logType, context, format, args); }
private static void DoLog(LogType logType, UnityEngine.Object context, string message) { logHandler.LogFormat(logType, context, message); }