mirror of
https://github.com/Prowlarr/Prowlarr.git
synced 2026-04-22 22:34:53 -04:00
safer log configuration
This commit is contained in:
@@ -6,18 +6,20 @@ namespace NzbDrone.Common.TPL
|
||||
{
|
||||
public static class TaskExtensions
|
||||
{
|
||||
private static readonly Logger Logger = NzbDroneLogger.GetLogger();
|
||||
private static readonly Logger Logger = NzbDroneLogger.GetLogger(typeof(TaskExtensions));
|
||||
|
||||
public static Task LogExceptions(this Task task)
|
||||
{
|
||||
task.ContinueWith(t =>
|
||||
{
|
||||
var aggregateException = t.Exception.Flatten();
|
||||
foreach (var exception in aggregateException.InnerExceptions)
|
||||
if (t.Exception != null)
|
||||
{
|
||||
Logger.ErrorException("Task Error", exception);
|
||||
var aggregateException = t.Exception.Flatten();
|
||||
foreach (var exception in aggregateException.InnerExceptions)
|
||||
{
|
||||
Logger.ErrorException("Task Error", exception);
|
||||
}
|
||||
}
|
||||
|
||||
}, TaskContinuationOptions.OnlyOnFaulted);
|
||||
|
||||
return task;
|
||||
|
||||
Reference in New Issue
Block a user