Browse Source

Added exception-only log functions

tags/docs-0.9
RogueException 9 years ago
parent
commit
3bdcd5ebb7
3 changed files with 28 additions and 3 deletions
  1. +0
    -3
      src/Discord.Net/DiscordClient.cs
  2. +14
    -0
      src/Discord.Net/Logging/LogManager.cs
  3. +14
    -0
      src/Discord.Net/Logging/Logger.cs

+ 0
- 3
src/Discord.Net/DiscordClient.cs View File

@@ -1009,8 +1009,5 @@ namespace Discord
Logger.Warning("Failed to cache token", ex);
}
}


}
}

+ 14
- 0
src/Discord.Net/Logging/LogManager.cs View File

@@ -37,22 +37,36 @@ namespace Discord.Logging
=> Log(LogSeverity.Error, source, message, ex);
public void Error(string source, FormattableString message, Exception ex = null)
=> Log(LogSeverity.Error, source, message, ex);
public void Error(string source, Exception ex)
=> Log(LogSeverity.Error, source, (string)null, ex);

public void Warning(string source, string message, Exception ex = null)
=> Log(LogSeverity.Warning, source, message, ex);
public void Warning(string source, FormattableString message, Exception ex = null)
=> Log(LogSeverity.Warning, source, message, ex);
public void Warning(string source, Exception ex)
=> Log(LogSeverity.Warning, source, (string)null, ex);

public void Info(string source, string message, Exception ex = null)
=> Log(LogSeverity.Info, source, message, ex);
public void Info(string source, FormattableString message, Exception ex = null)
=> Log(LogSeverity.Info, source, message, ex);
public void Info(string source, Exception ex)
=> Log(LogSeverity.Info, source, (string)null, ex);

public void Verbose(string source, string message, Exception ex = null)
=> Log(LogSeverity.Verbose, source, message, ex);
public void Verbose(string source, FormattableString message, Exception ex = null)
=> Log(LogSeverity.Verbose, source, message, ex);
public void Verbose(string source, Exception ex)
=> Log(LogSeverity.Verbose, source, (string)null, ex);

public void Debug(string source, string message, Exception ex = null)
=> Log(LogSeverity.Debug, source, message, ex);
public void Debug(string source, FormattableString message, Exception ex = null)
=> Log(LogSeverity.Debug, source, message, ex);
public void Debug(string source, Exception ex)
=> Log(LogSeverity.Debug, source, (string)null, ex);

public Logger CreateLogger(string name) => new Logger(this, name);
}


+ 14
- 0
src/Discord.Net/Logging/Logger.cs View File

@@ -24,21 +24,35 @@ namespace Discord.Logging
=> _manager.Error(Name, message, exception);
public void Error(FormattableString message, Exception exception = null)
=> _manager.Error(Name, message, exception);
public void Error(Exception exception)
=> _manager.Error(Name, exception);

public void Warning(string message, Exception exception = null)
=> _manager.Warning(Name, message, exception);
public void Warning(FormattableString message, Exception exception = null)
=> _manager.Warning(Name, message, exception);
public void Warning(Exception exception)
=> _manager.Warning(Name, exception);

public void Info(string message, Exception exception = null)
=> _manager.Info(Name, message, exception);
public void Info(FormattableString message, Exception exception = null)
=> _manager.Info(Name, message, exception);
public void Info(Exception exception)
=> _manager.Info(Name, exception);

public void Verbose(string message, Exception exception = null)
=> _manager.Verbose(Name, message, exception);
public void Verbose(FormattableString message, Exception exception = null)
=> _manager.Verbose(Name, message, exception);
public void Verbose(Exception exception)
=> _manager.Verbose(Name, exception);

public void Debug(string message, Exception exception = null)
=> _manager.Debug(Name, message, exception);
public void Debug(FormattableString message, Exception exception = null)
=> _manager.Debug(Name, message, exception);
public void Debug(Exception exception)
=> _manager.Debug(Name, exception);
}
}

Loading…
Cancel
Save