Browse Source

LogManager should never leak exceptions

tags/1.0-rc
RogueException 8 years ago
parent
commit
ce2b5da6de
1 changed files with 17 additions and 5 deletions
  1. +17
    -5
      src/Discord.Net.Core/Logging/LogManager.cs

+ 17
- 5
src/Discord.Net.Core/Logging/LogManager.cs View File

@@ -19,19 +19,31 @@ namespace Discord.Logging

public async Task LogAsync(LogSeverity severity, string source, Exception ex)
{
if (severity <= Level)
await _messageEvent.InvokeAsync(new LogMessage(severity, source, null, ex)).ConfigureAwait(false);
try
{
if (severity <= Level)
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)
{
if (severity <= Level)
try
{
if (severity <= Level)
await _messageEvent.InvokeAsync(new LogMessage(severity, source, message, ex)).ConfigureAwait(false);
}
catch { }
}
#if NETSTANDARD1_3
public async Task LogAsync(LogSeverity severity, string source, FormattableString message, Exception ex = null)
{
if (severity <= Level)
await _messageEvent.InvokeAsync(new LogMessage(severity, source, message.ToString(), ex)).ConfigureAwait(false);
try
{
if (severity <= Level)
await _messageEvent.InvokeAsync(new LogMessage(severity, source, message.ToString(), ex)).ConfigureAwait(false);
}
catch { }
}
#endif



Loading…
Cancel
Save