LogManager should never leak exceptions

This commit is contained in:
RogueException
2017-04-01 11:38:37 -03:00
parent 7242a85200
commit ce2b5da6de

View File

@@ -18,21 +18,33 @@ namespace Discord.Logging
} }
public async Task LogAsync(LogSeverity severity, string source, Exception ex) public async Task LogAsync(LogSeverity severity, string source, Exception ex)
{
try
{ {
if (severity <= Level) if (severity <= Level)
await _messageEvent.InvokeAsync(new LogMessage(severity, source, null, ex)).ConfigureAwait(false); await _messageEvent.InvokeAsync(new LogMessage(severity, source, null, ex)).ConfigureAwait(false);
} }
catch { }
}
public async Task LogAsync(LogSeverity severity, string source, string message, Exception ex = null) public async Task LogAsync(LogSeverity severity, string source, string message, Exception ex = null)
{
try
{ {
if (severity <= Level) if (severity <= Level)
await _messageEvent.InvokeAsync(new LogMessage(severity, source, message, ex)).ConfigureAwait(false); await _messageEvent.InvokeAsync(new LogMessage(severity, source, message, ex)).ConfigureAwait(false);
} }
catch { }
}
#if NETSTANDARD1_3 #if NETSTANDARD1_3
public async Task LogAsync(LogSeverity severity, string source, FormattableString message, Exception ex = null) public async Task LogAsync(LogSeverity severity, string source, FormattableString message, Exception ex = null)
{
try
{ {
if (severity <= Level) if (severity <= Level)
await _messageEvent.InvokeAsync(new LogMessage(severity, source, message.ToString(), ex)).ConfigureAwait(false); await _messageEvent.InvokeAsync(new LogMessage(severity, source, message.ToString(), ex)).ConfigureAwait(false);
} }
catch { }
}
#endif #endif
public Task ErrorAsync(string source, Exception ex) public Task ErrorAsync(string source, Exception ex)