public static void Add(LogSeverity Severity, LogDir logDir, string text) { Task.Factory.StartNew(() => { string finalText = ""; switch (Severity) { case LogSeverity.SERVERINFO: finalText += "[SERVER INFO]"; break; case LogSeverity.INFO: finalText += "[INFO]"; break; case LogSeverity.WARNING: finalText += "[WARN]"; break; case LogSeverity.ERROR: finalText += "[ERR]"; break; } finalText += "[" + DateTime.Now + "]"; finalText += "[" + logDir + "] "; finalText += text; Console.WriteLine(finalText); }); }
public static void Add(LogSeverity Severity, LogDir logDir, string text) { string finalText = ""; switch (Severity) { case LogSeverity.SERVERINFO: Console.ForegroundColor = ConsoleColor.DarkGreen; finalText += "[SERVER INFO]"; break; case LogSeverity.INFO: Console.ForegroundColor = ConsoleColor.Green; finalText += "[INFO]"; break; case LogSeverity.WARNING: Console.ForegroundColor = ConsoleColor.Yellow; finalText += "[WARN]"; break; case LogSeverity.ERROR: Console.ForegroundColor = ConsoleColor.DarkRed; finalText += "[ERR]"; break; } finalText += "[" + System.DateTime.Now + "]"; finalText += "[" + logDir + "] "; finalText += text; Console.WriteLine(finalText); Console.ForegroundColor = ConsoleColor.White; }
public override int GetHashCode() { int hash = 1; if (LogDir.Length != 0) { hash ^= LogDir.GetHashCode(); } if (Debug != false) { hash ^= Debug.GetHashCode(); } if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } return(hash); }
private void UpdateDirectories() { if (!Directory.Exists("./Storage/Logs")) return; String[] chans = Directory.GetDirectories("./Storage/Logs"); foreach (String chan in chans) { LogDir dir = new LogDir(); String _chan = Path.GetFileName(chan); if (ChannelDropdown.Items.Contains(_chan)) continue; ChannelDropdown.Items.Add(_chan); String[] months = Directory.GetDirectories("./Storage/Logs/" + _chan); foreach (String month in months) { String _month = Path.GetFileName(month); if (!dir.Logs.ContainsKey(_month)) { List<String> days = new List<string>(); foreach (String day in Directory.GetFiles("./Storage/Logs/" + _chan + "/" + _month)) { days.Add(Path.GetFileName(day)); } dir.Logs.Add(_month, days); } } _subdirs.Add(_chan, dir); } }