| @@ -16,69 +16,59 @@ namespace Discord.Logging | |||||
| Level = client.Config.LogLevel; | Level = client.Config.LogLevel; | ||||
| } | } | ||||
| #if DOTNET5_4 | |||||
| public void Log(LogSeverity severity, string source, FormattableString message, Exception exception = null) | |||||
| public void Log(LogSeverity severity, string source, string message, Exception exception = null) | |||||
| { | { | ||||
| if (severity <= Level) | if (severity <= Level) | ||||
| { | { | ||||
| try { Message(this, new LogMessageEventArgs(severity, source, message.ToString(), exception)); } | |||||
| try { Message(this, new LogMessageEventArgs(severity, source, message, exception)); } | |||||
| catch { } //We dont want to log on log errors | catch { } //We dont want to log on log errors | ||||
| } | } | ||||
| } | } | ||||
| #endif | |||||
| public void Log(LogSeverity severity, string source, string message, Exception exception = null) | |||||
| #if DOTNET5_4 | |||||
| public void Log(LogSeverity severity, string source, FormattableString message, Exception exception = null) | |||||
| { | { | ||||
| if (severity <= Level) | if (severity <= Level) | ||||
| { | { | ||||
| try { Message(this, new LogMessageEventArgs(severity, source, message, exception)); } | |||||
| try { Message(this, new LogMessageEventArgs(severity, source, message.ToString(), exception)); } | |||||
| catch { } //We dont want to log on log errors | catch { } //We dont want to log on log errors | ||||
| } | } | ||||
| } | } | ||||
| #endif | |||||
| public void Error(string source, string message, Exception ex = null) | public void Error(string source, string message, Exception ex = null) | ||||
| => Log(LogSeverity.Error, source, message, ex); | => Log(LogSeverity.Error, source, message, ex); | ||||
| #if DOTNET5_4 | |||||
| public void Error(string source, FormattableString message, Exception ex = null) | |||||
| => Log(LogSeverity.Error, source, message, ex); | |||||
| #endif | |||||
| public void Error(string source, Exception ex) | public void Error(string source, Exception ex) | ||||
| => Log(LogSeverity.Error, source, (string)null, ex); | => Log(LogSeverity.Error, source, (string)null, ex); | ||||
| public void Warning(string source, string message, Exception ex = null) | public void Warning(string source, string message, Exception ex = null) | ||||
| => Log(LogSeverity.Warning, source, message, ex); | => Log(LogSeverity.Warning, source, message, ex); | ||||
| #if DOTNET5_4 | |||||
| public void Warning(string source, FormattableString message, Exception ex = null) | |||||
| => Log(LogSeverity.Warning, source, message, ex); | |||||
| #endif | |||||
| public void Warning(string source, Exception ex) | public void Warning(string source, Exception ex) | ||||
| => Log(LogSeverity.Warning, source, (string)null, ex); | => Log(LogSeverity.Warning, source, (string)null, ex); | ||||
| public void Info(string source, string message, Exception ex = null) | public void Info(string source, string message, Exception ex = null) | ||||
| => Log(LogSeverity.Info, source, message, ex); | => Log(LogSeverity.Info, source, message, ex); | ||||
| #if DOTNET5_4 | |||||
| public void Info(string source, FormattableString message, Exception ex = null) | |||||
| => Log(LogSeverity.Info, source, message, ex); | |||||
| #endif | |||||
| public void Info(string source, Exception ex) | public void Info(string source, Exception ex) | ||||
| => Log(LogSeverity.Info, source, (string)null, ex); | => Log(LogSeverity.Info, source, (string)null, ex); | ||||
| public void Verbose(string source, string message, Exception ex = null) | public void Verbose(string source, string message, Exception ex = null) | ||||
| => Log(LogSeverity.Verbose, source, message, ex); | => Log(LogSeverity.Verbose, source, message, ex); | ||||
| #if DOTNET5_4 | |||||
| public void Verbose(string source, FormattableString message, Exception ex = null) | |||||
| => Log(LogSeverity.Verbose, source, message, ex); | |||||
| #endif | |||||
| public void Verbose(string source, Exception ex) | public void Verbose(string source, Exception ex) | ||||
| => Log(LogSeverity.Verbose, source, (string)null, ex); | => Log(LogSeverity.Verbose, source, (string)null, ex); | ||||
| public void Debug(string source, string message, Exception ex = null) | public void Debug(string source, string message, Exception ex = null) | ||||
| => Log(LogSeverity.Debug, source, message, ex); | => Log(LogSeverity.Debug, source, message, ex); | ||||
| public void Debug(string source, Exception ex) | |||||
| => Log(LogSeverity.Debug, source, (string)null, ex); | |||||
| #if DOTNET5_4 | #if DOTNET5_4 | ||||
| public void Error(string source, FormattableString message, Exception ex = null) | |||||
| => Log(LogSeverity.Error, source, message, ex); | |||||
| public void Warning(string source, FormattableString message, Exception ex = null) | |||||
| => Log(LogSeverity.Warning, source, message, ex); | |||||
| public void Info(string source, FormattableString message, Exception ex = null) | |||||
| => Log(LogSeverity.Info, source, message, ex); | |||||
| public void Verbose(string source, FormattableString message, Exception ex = null) | |||||
| => Log(LogSeverity.Verbose, source, message, ex); | |||||
| public void Debug(string source, FormattableString message, Exception ex = null) | public void Debug(string source, FormattableString message, Exception ex = null) | ||||
| => Log(LogSeverity.Debug, source, message, ex); | => Log(LogSeverity.Debug, source, message, ex); | ||||
| #endif | #endif | ||||
| public void Debug(string source, Exception ex) | |||||
| => Log(LogSeverity.Debug, source, (string)null, ex); | |||||
| public Logger CreateLogger(string name) => new Logger(this, name); | public Logger CreateLogger(string name) => new Logger(this, name); | ||||
| } | } | ||||