diff options
| author | Bond_009 <bond.009@outlook.com> | 2018-12-13 14:18:25 +0100 |
|---|---|---|
| committer | Bond_009 <bond.009@outlook.com> | 2018-12-30 22:44:38 +0100 |
| commit | 0f8b3c634708ce8e7b2e2ae6fed87b6b943b5bca (patch) | |
| tree | 3b2440977592f46598ee1961199ec2c0fd3455ac /Emby.Server.Implementations/ScheduledTasks/ScheduledTaskWorker.cs | |
| parent | b0fd432126606d7008544ff0237beabc52109e02 (diff) | |
Use Microsoft.Extensions.Logging abstraction
Diffstat (limited to 'Emby.Server.Implementations/ScheduledTasks/ScheduledTaskWorker.cs')
| -rw-r--r-- | Emby.Server.Implementations/ScheduledTasks/ScheduledTaskWorker.cs | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/Emby.Server.Implementations/ScheduledTasks/ScheduledTaskWorker.cs b/Emby.Server.Implementations/ScheduledTasks/ScheduledTaskWorker.cs index eeb38bf54..93e02063b 100644 --- a/Emby.Server.Implementations/ScheduledTasks/ScheduledTaskWorker.cs +++ b/Emby.Server.Implementations/ScheduledTasks/ScheduledTaskWorker.cs @@ -10,7 +10,7 @@ using MediaBrowser.Common.Extensions; using MediaBrowser.Common.Progress; using MediaBrowser.Model.Events; using MediaBrowser.Model.IO; -using MediaBrowser.Model.Logging; +using Microsoft.Extensions.Logging; using MediaBrowser.Model.Serialization; using MediaBrowser.Model.System; using MediaBrowser.Model.Tasks; @@ -146,7 +146,7 @@ namespace Emby.Server.Implementations.ScheduledTasks } catch (Exception ex) { - Logger.ErrorException("Error deserializing {0}", ex, path); + Logger.LogError("Error deserializing {0}", ex, path); } _readFromFile = true; } @@ -360,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(); @@ -408,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); @@ -436,7 +436,7 @@ namespace Emby.Server.Implementations.ScheduledTasks } catch (Exception ex) { - Logger.ErrorException("Error", ex); + Logger.LogError("Error", ex); failureException = ex; @@ -493,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(); } } @@ -614,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 { @@ -664,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("Error calling CancellationToken.Cancel();", ex); } } var task = _currentTask; @@ -677,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("Error calling Task.WaitAll();", ex); } } @@ -699,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("Error calling CancellationToken.Dispose();", ex); } } if (wassRunning) |
