aboutsummaryrefslogtreecommitdiff
path: root/Emby.Server.Implementations/ScheduledTasks/ScheduledTaskWorker.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Emby.Server.Implementations/ScheduledTasks/ScheduledTaskWorker.cs')
-rw-r--r--Emby.Server.Implementations/ScheduledTasks/ScheduledTaskWorker.cs35
1 files changed, 17 insertions, 18 deletions
diff --git a/Emby.Server.Implementations/ScheduledTasks/ScheduledTaskWorker.cs b/Emby.Server.Implementations/ScheduledTasks/ScheduledTaskWorker.cs
index f6397b670..7c2ce4af3 100644
--- a/Emby.Server.Implementations/ScheduledTasks/ScheduledTaskWorker.cs
+++ b/Emby.Server.Implementations/ScheduledTasks/ScheduledTaskWorker.cs
@@ -9,9 +9,8 @@ using MediaBrowser.Common.Events;
using MediaBrowser.Common.Extensions;
using MediaBrowser.Common.Progress;
using MediaBrowser.Model.Events;
-using MediaBrowser.Model.Extensions;
using MediaBrowser.Model.IO;
-using MediaBrowser.Model.Logging;
+using Microsoft.Extensions.Logging;
using MediaBrowser.Model.Serialization;
using MediaBrowser.Model.System;
using MediaBrowser.Model.Tasks;
@@ -147,7 +146,7 @@ namespace Emby.Server.Implementations.ScheduledTasks
}
catch (Exception ex)
{
- Logger.ErrorException("Error deserializing {0}", ex, path);
+ Logger.LogError(ex, "Error deserializing {path}", path);
}
_readFromFile = true;
}
@@ -276,7 +275,7 @@ namespace Emby.Server.Implementations.ScheduledTasks
get
{
var triggers = InternalTriggers;
- return triggers.Select(i => i.Item1).ToArray(triggers.Length);
+ return triggers.Select(i => i.Item1).ToArray();
}
set
{
@@ -290,7 +289,7 @@ namespace Emby.Server.Implementations.ScheduledTasks
SaveTriggers(triggerList);
- InternalTriggers = triggerList.Select(i => new Tuple<TaskTriggerInfo, ITaskTrigger>(i, GetTrigger(i))).ToArray(triggerList.Length);
+ InternalTriggers = triggerList.Select(i => new Tuple<TaskTriggerInfo, ITaskTrigger>(i, GetTrigger(i))).ToArray();
}
}
@@ -361,7 +360,7 @@ namespace Emby.Server.Implementations.ScheduledTasks
return;
}
- Logger.Info("{0} fired for task: {1}", trigger.GetType().Name, Name);
+ Logger.LogInformation("{0} fired for task: {1}", trigger.GetType().Name, Name);
trigger.Stop();
@@ -409,7 +408,7 @@ namespace Emby.Server.Implementations.ScheduledTasks
CurrentCancellationTokenSource = new CancellationTokenSource();
- Logger.Info("Executing {0}", Name);
+ Logger.LogInformation("Executing {0}", Name);
((TaskManager)TaskManager).OnTaskExecuting(this);
@@ -437,7 +436,7 @@ namespace Emby.Server.Implementations.ScheduledTasks
}
catch (Exception ex)
{
- Logger.ErrorException("Error", ex);
+ Logger.LogError(ex, "Error");
failureException = ex;
@@ -494,7 +493,7 @@ namespace Emby.Server.Implementations.ScheduledTasks
{
if (State == TaskState.Running)
{
- Logger.Info("Attempting to cancel Scheduled Task {0}", Name);
+ Logger.LogInformation("Attempting to cancel Scheduled Task {0}", Name);
CurrentCancellationTokenSource.Cancel();
}
}
@@ -615,7 +614,7 @@ namespace Emby.Server.Implementations.ScheduledTasks
{
var elapsedTime = endTime - startTime;
- Logger.Info("{0} {1} after {2} minute(s) and {3} seconds", Name, status, Math.Truncate(elapsedTime.TotalMinutes), elapsedTime.Seconds);
+ Logger.LogInformation("{0} {1} after {2} minute(s) and {3} seconds", Name, status, Math.Truncate(elapsedTime.TotalMinutes), elapsedTime.Seconds);
var result = new TaskResult
{
@@ -665,12 +664,12 @@ namespace Emby.Server.Implementations.ScheduledTasks
{
try
{
- Logger.Info(Name + ": Cancelling");
+ Logger.LogInformation(Name + ": Cancelling");
token.Cancel();
}
catch (Exception ex)
{
- Logger.ErrorException("Error calling CancellationToken.Cancel();", ex);
+ Logger.LogError(ex, "Error calling CancellationToken.Cancel();");
}
}
var task = _currentTask;
@@ -678,21 +677,21 @@ namespace Emby.Server.Implementations.ScheduledTasks
{
try
{
- Logger.Info(Name + ": Waiting on Task");
+ Logger.LogInformation(Name + ": Waiting on Task");
var exited = Task.WaitAll(new[] { task }, 2000);
if (exited)
{
- Logger.Info(Name + ": Task exited");
+ Logger.LogInformation(Name + ": Task exited");
}
else
{
- Logger.Info(Name + ": Timed out waiting for task to stop");
+ Logger.LogInformation(Name + ": Timed out waiting for task to stop");
}
}
catch (Exception ex)
{
- Logger.ErrorException("Error calling Task.WaitAll();", ex);
+ Logger.LogError(ex, "Error calling Task.WaitAll();");
}
}
@@ -700,12 +699,12 @@ namespace Emby.Server.Implementations.ScheduledTasks
{
try
{
- Logger.Debug(Name + ": Disposing CancellationToken");
+ Logger.LogDebug(Name + ": Disposing CancellationToken");
token.Dispose();
}
catch (Exception ex)
{
- Logger.ErrorException("Error calling CancellationToken.Dispose();", ex);
+ Logger.LogError(ex, "Error calling CancellationToken.Dispose();");
}
}
if (wassRunning)