/// <summary> /// Logs the information to the console /// </summary> /// <param name="information"></param> public void LogConsole(string information, LogSeverity severity = LogSeverity.Information) { string time = DateTime.Now.ToString("T"); string severe = severity.CanPrintFormat() ? $" {severity.GetFormatted()} " : " "; Console.WriteLine($"{time}{severe}[{Name}] {information}"); }
/// <summary> /// Logs an exception to the console with detailed exception information /// </summary> /// <param name="head"></param> /// <param name="description"></param> /// <param name="date"></param> /// <param name="exception"></param> public void LogExceptionConsole(Exception exception, bool printExceptionStacktrace = true, LogSeverity severity = LogSeverity.Warning) { string dateTime = DateTime.Now.ToString("T"); string severe = severity.CanPrintFormat() ? $" {severity.GetFormatted()} " : " "; Console.WriteLine($"{dateTime}{severe}[{Name}] An exception has occoured"); if (exception != null) { Console.WriteLine($"Exception: {exception.Message}"); if (printExceptionStacktrace) { Console.WriteLine($"Stacktrace:\n{exception.StackTrace}"); } } }