Moved Fatal logging to use nlog patterns

This commit is contained in:
Keivan Beigi 2017-01-05 14:33:40 -08:00
parent 782efcfaf1
commit e45d4f60a4
5 changed files with 13 additions and 15 deletions

View File

@ -63,18 +63,16 @@ namespace NzbDrone.Api.ErrorManagement
}.AsResponse(HttpStatusCode.Conflict);
}
var sqlErrorMessage = string.Format("[{0} {1}]", context.Request.Method, context.Request.Path);
_logger.Error(sqLiteException, sqlErrorMessage);
_logger.Error(sqLiteException, "[{0} {1}]", context.Request.Method, context.Request.Path);
}
_logger.Fatal(exception, "Request Failed");
_logger.Fatal(exception, "Request Failed. {0} {1}", context.Request.Method, context.Request.Path);
return new ErrorModel
{
Message = exception.Message,
Description = exception.ToString()
}.AsResponse(HttpStatusCode.InternalServerError);
{
Message = exception.Message,
Description = exception.ToString()
}.AsResponse(HttpStatusCode.InternalServerError);
}
}
}

View File

@ -46,7 +46,7 @@ namespace NzbDrone.Common.Instrumentation
}
Console.WriteLine("EPIC FAIL: {0}", exception);
Logger.Fatal(exception, "EPIC FAIL: " + exception.Message);
Logger.Fatal(exception, "EPIC FAIL.");
}
}
}

View File

@ -77,7 +77,7 @@ namespace NzbDrone.Core.Tv
}
catch (Exception e)
{
_logger.Fatal(e, string.Format("An error has occurred while updating episode info for series {0}. {1}", series, episode));
_logger.Fatal(e, "An error has occurred while updating episode info for series {0}. {1}", series, episode));
failCount++;
}
}
@ -126,7 +126,7 @@ namespace NzbDrone.Core.Tv
}
var groups = allEpisodes.Where(c => c.AirDateUtc.HasValue)
.GroupBy(e => new {e.SeasonNumber, e.AirDate})
.GroupBy(e => new { e.SeasonNumber, e.AirDate })
.Where(g => g.Count() > 1)
.ToList();

View File

@ -6,6 +6,7 @@
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=ConvertNullableToShortForm/@EntryIndexedValue">DO_NOT_SHOW</s:String>
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=FunctionRecursiveOnAllPaths/@EntryIndexedValue">ERROR</s:String>
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=InvokeAsExtensionMethod/@EntryIndexedValue">ERROR</s:String>
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=LocalizableElement/@EntryIndexedValue">DO_NOT_SHOW</s:String>
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=NUnit_002ENonPublicMethodWithTestAttribute/@EntryIndexedValue">ERROR</s:String>
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=ReturnTypeCanBeEnumerable_002EGlobal/@EntryIndexedValue">HINT</s:String>
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=StringLiteralTypo/@EntryIndexedValue">WARNING</s:String>

View File

@ -29,9 +29,8 @@ namespace NzbDrone
}
catch (Exception e)
{
Logger.Fatal(e, "EPIC FAIL: " + e.Message);
var message = string.Format("{0}: {1}", e.GetType().Name, e.Message);
MessageBox.Show(text: message, buttons: MessageBoxButtons.OK, icon: MessageBoxIcon.Error, caption: "Epic Fail!");
Logger.Fatal(e, "EPIC FAIL");
MessageBox.Show($"{e.GetType().Name}: {e.Message}", buttons: MessageBoxButtons.OK, icon: MessageBoxIcon.Error, caption: "Epic Fail!");
}
}
}