public static void Write(LogType type, LogComponent component, string message, params object[] args) { if ((_type & type) != 0 && (_components & component) != 0) { // // My log has something to tell you... Console.WriteLine("[" + DateTime.Now + "] " + component.ToString() + ": " + message, args); if (_logStream != null) { _logStream.WriteLine(component.ToString() + ": " + message, args); } } }
public static void Write(LogType type, LogComponent component, string message, params object[] args) { if ((_type & type) != 0 && (_components & component) != 0) { // // My log has something to tell you... // TODO: color based on type, etc. Console.WriteLine(component.ToString() + ": " + message, args); if (_logStream != null) { _logStream.WriteLine(component.ToString() + ": " + message, args); } } }
public static void LogError(LogComponent component, DateTime timestamp) { string line = string.Format($"[{timestamp}] {component.ToString()} ERROR"); StreamWriter sw; lock (syncLock) { if (!File.Exists(filename)) { sw = File.CreateText(filename); } else { sw = File.AppendText(filename); } sw.WriteLine(line); sw.Close(); } }