public void Append(LogLevel logLevel, LogMetaData logMetaData, string message, params object[] args) { System.Action <string, object[]> unityLogFunction; switch (logLevel) { default: unityLogFunction = Debug.LogFormat; break; case LogLevel.Warning: unityLogFunction = Debug.LogWarningFormat; break; case LogLevel.Error: unityLogFunction = Debug.LogErrorFormat; break; } unityLogFunction(string.Format("{0} {1}: {2}", logLevel, logMetaData.GetClassName(), message), args); }
public void Append(LogLevel logLevel, LogMetaData logMetaData, string message, params object[] args) { string line = string.Format("[{0}] {1} {2}: {3}", logMetaData.GetTimestamp().ToString("yyyy-MM-dd-HH\\:mm\\:ss"), logLevel, logMetaData.GetClassName(), string.Format(message, args)); lock (lines) { lines.Add(line); } if (lines.Count > 99 || System.DateTime.UtcNow > lastFlushDateTime.AddSeconds(2)) { Flush(); } }