diff options
| author | Joshua M. Boniface <joshua@boniface.me> | 2018-12-30 17:29:02 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2018-12-30 17:29:02 -0500 |
| commit | 1f02cf4b7e13c932bc30968cbb74b71885fd3eb7 (patch) | |
| tree | 2fbf2e570340765abd40b5ad8e491f1f212699c0 /Emby.Server.Implementations/ScheduledTasks/ScheduledTaskWorker.cs | |
| parent | 7ad023143062c1995178e5700961b553822bd5af (diff) | |
| parent | 4c95aee52eda793d1e013164cc0fde9eb609f894 (diff) | |
Merge pull request #285 from Bond-009/logging
Use Serilog to handle logging
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..7c2ce4af3 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(ex, "Error deserializing {path}", 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(ex, "Error"); 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(ex, "Error calling CancellationToken.Cancel();"); } } 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(ex, "Error calling Task.WaitAll();"); } } @@ -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(ex, "Error calling CancellationToken.Dispose();"); } } if (wassRunning) |
