internal void WriteLog(string Message, LoggerWarringLevel Level = LoggerWarringLevel.RegularMessage, LoggerLogType Type = LoggerLogType.All) { switch (Type) { case LoggerLogType.All: WriteLocalLogEntry(Message, Level); WriteServerLogEntry(Message, Level); WriteWindowsLogEntry(Message, Level); break; case LoggerLogType.LocalLog: WriteLocalLogEntry(Message, Level); break; case LoggerLogType.ServerLog: WriteServerLogEntry(Message, Level); break; case LoggerLogType.WindowsLog: WriteWindowsLogEntry(Message, Level); break; case LoggerLogType.LocalLog | LoggerLogType.ServerLog: WriteLocalLogEntry(Message); WriteServerLogEntry(Message, Level); break; case LoggerLogType.LocalLog | LoggerLogType.WindowsLog: WriteLocalLogEntry(Message, Level); WriteWindowsLogEntry(Message, Level); break; case LoggerLogType.ServerLog | LoggerLogType.WindowsLog: WriteServerLogEntry(Message, Level); WriteWindowsLogEntry(Message, Level); break; } WriteConsole(Message, Level); }
internal void WriteConsole(string Message, LoggerWarringLevel Level = LoggerWarringLevel.RegularMessage) { #if DEBUG lock (ArcadeServiceEventEventLog) try { ConsoleColor ReturnColor = Console.ForegroundColor; switch (Level) { case LoggerWarringLevel.RegularMessage: Console.ForegroundColor = ConsoleColor.White; Console.WriteLine(BuildLogString(Message, Level)); Console.ForegroundColor = ReturnColor; break; case LoggerWarringLevel.Warring: Console.ForegroundColor = ConsoleColor.Yellow; Console.WriteLine(BuildLogString(Message, Level)); Console.ForegroundColor = ReturnColor; break; case LoggerWarringLevel.Danger: Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine(BuildLogString(Message, Level)); Console.ForegroundColor = ReturnColor; break; case LoggerWarringLevel.CriticalError: Console.ForegroundColor = ConsoleColor.Magenta; Console.WriteLine(BuildLogString(Message, Level)); Console.ForegroundColor = ReturnColor; break; } } catch {} #endif }
string BuildLogString(string Message, LoggerWarringLevel Level) { return("<" + Level + " Time=\"" + DateTime.UtcNow + "\">" + Message + "</" + Level + ">"); }
internal void WriteServerLogEntry(string Message, LoggerWarringLevel Level = LoggerWarringLevel.RegularMessage) { //throw new NotImplementedException(); }
internal void WriteLocalLogEntry(string Message, LoggerWarringLevel Level = LoggerWarringLevel.RegularMessage) { lock (ArcadeServiceEventEventLog) using (StreamWriter SW = new StreamWriter(LocalLog, true)) SW.WriteLine(BuildLogString(Message, Level)); }
internal void WriteWindowsLogEntry(string Message, LoggerWarringLevel Level = LoggerWarringLevel.RegularMessage) { //lock(ArcadeServiceEventEventLog) // ArcadeServiceEventEventLog.WriteEntry(BuildLogString(Message, Level)); }