Fixed: Generic SignalR messages no longer treated as errors

pull/3113/head
Mark McDowall 10 years ago
parent 4b7ee3cb9e
commit 918fcac2aa

@ -31,7 +31,7 @@ namespace NzbDrone.Common.Instrumentation
if (exception is NullReferenceException && if (exception is NullReferenceException &&
exception.ToString().Contains("Microsoft.AspNet.SignalR.Transports.TransportHeartbeat.ProcessServerCommand")) exception.ToString().Contains("Microsoft.AspNet.SignalR.Transports.TransportHeartbeat.ProcessServerCommand"))
{ {
Logger.Warn("SignalR Heartbeat error."); Logger.Warn("SignalR Heartbeat interupted");
return; return;
} }

@ -32,19 +32,39 @@ namespace NzbDrone.Host.Owin
public override void Write(string value) public override void Write(string value)
{ {
if (value.ToLower().Contains("error") && !(value.ToLower().Contains("sqlite") || value.ToLower().Contains("\"errors\":null"))) _logger.Log(GetLogLevel(value), value);
{
_logger.Error(value);
} }
else
public override void Write(char value)
{ {
_logger.Trace(value); _logger.Trace(value);
} }
private LogLevel GetLogLevel(string value)
{
var lower = value;
if (!lower.Contains("error"))
{
return LogLevel.Trace;
} }
public override void Write(char value) if (lower.Contains("sqlite"))
{ {
_logger.Trace(value); return LogLevel.Trace;
}
if (lower.Contains("\"errors\":null"))
{
return LogLevel.Trace;
}
if (lower.Contains("signalr") && lower.Contains("an operation was attempted on a nonexistent network connection"))
{
return LogLevel.Trace;
}
return LogLevel.Error;
} }
} }
} }
Loading…
Cancel
Save