diff options
| author | Bond_009 <bond.009@outlook.com> | 2018-12-20 13:11:26 +0100 |
|---|---|---|
| committer | Bond_009 <bond.009@outlook.com> | 2018-12-30 22:44:39 +0100 |
| commit | ea4c914123ba8279b9d9fcf7d5318e11f7a3da4c (patch) | |
| tree | 455bf175270ffd7c1cb8f4e4ea0fb41851f7c59e /MediaBrowser.Api | |
| parent | bf01918659986cc6cbaefaebb67f607aeb1b4400 (diff) | |
Fix exception logging
Diffstat (limited to 'MediaBrowser.Api')
| -rw-r--r-- | MediaBrowser.Api/ApiEntryPoint.cs | 20 | ||||
| -rw-r--r-- | MediaBrowser.Api/Images/ImageService.cs | 2 | ||||
| -rw-r--r-- | MediaBrowser.Api/Library/LibraryService.cs | 2 | ||||
| -rw-r--r-- | MediaBrowser.Api/Playback/BaseStreamingService.cs | 4 | ||||
| -rw-r--r-- | MediaBrowser.Api/Playback/Hls/DynamicHlsService.cs | 4 | ||||
| -rw-r--r-- | MediaBrowser.Api/Playback/StreamState.cs | 6 | ||||
| -rw-r--r-- | MediaBrowser.Api/Playback/TranscodingThrottler.cs | 20 | ||||
| -rw-r--r-- | MediaBrowser.Api/PluginService.cs | 6 | ||||
| -rw-r--r-- | MediaBrowser.Api/Subtitles/SubtitleService.cs | 2 |
9 files changed, 33 insertions, 33 deletions
diff --git a/MediaBrowser.Api/ApiEntryPoint.cs b/MediaBrowser.Api/ApiEntryPoint.cs index b51bdf6fd..ed0a0c81a 100644 --- a/MediaBrowser.Api/ApiEntryPoint.cs +++ b/MediaBrowser.Api/ApiEntryPoint.cs @@ -147,7 +147,7 @@ namespace MediaBrowser.Api } catch (Exception ex) { - Logger.LogError("Error deleting encoded media cache", ex); + Logger.LogError(ex, "Error deleting encoded media cache"); } } @@ -557,7 +557,7 @@ namespace MediaBrowser.Api { try { - Logger.LogInformation("Stopping ffmpeg process with q command for {0}", job.Path); + Logger.LogInformation("Stopping ffmpeg process with q command for {path}", job.Path); //process.Kill(); process.StandardInput.WriteLine("q"); @@ -565,13 +565,13 @@ namespace MediaBrowser.Api // Need to wait because killing is asynchronous if (!process.WaitForExit(5000)) { - Logger.LogInformation("Killing ffmpeg process for {0}", job.Path); + Logger.LogInformation("Killing ffmpeg process for {path}", job.Path); process.Kill(); } } catch (Exception ex) { - Logger.LogError("Error killing transcoding job for {0}", ex, job.Path); + Logger.LogError(ex, "Error killing transcoding job for {path}", job.Path); } } } @@ -589,7 +589,7 @@ namespace MediaBrowser.Api } catch (Exception ex) { - Logger.LogError("Error closing live stream for {0}", ex, job.Path); + Logger.LogError(ex, "Error closing live stream for {path}", job.Path); } } } @@ -620,15 +620,15 @@ namespace MediaBrowser.Api { } - catch (IOException) + catch (IOException ex) { - //Logger.LogError("Error deleting partial stream file(s) {0}", ex, path); + Logger.LogError(ex, "Error deleting partial stream file(s) {path}", path); DeletePartialStreamFiles(path, jobType, retryCount + 1, 500); } - catch + catch (Exception ex) { - //Logger.LogError("Error deleting partial stream file(s) {0}", ex, path); + Logger.LogError(ex, "Error deleting partial stream file(s) {path}", path); } } @@ -670,7 +670,7 @@ namespace MediaBrowser.Api catch (IOException ex) { e = ex; - //Logger.LogError("Error deleting HLS file {0}", ex, file); + Logger.LogError(ex, "Error deleting HLS file {path}", file); } } diff --git a/MediaBrowser.Api/Images/ImageService.cs b/MediaBrowser.Api/Images/ImageService.cs index 28a424512..17c6d5dc5 100644 --- a/MediaBrowser.Api/Images/ImageService.cs +++ b/MediaBrowser.Api/Images/ImageService.cs @@ -362,7 +362,7 @@ namespace MediaBrowser.Api.Images } catch (Exception ex) { - Logger.LogError("Error getting image information for {0}", ex, info.Path); + Logger.LogError(ex, "Error getting image information for {path}", info.Path); return null; } diff --git a/MediaBrowser.Api/Library/LibraryService.cs b/MediaBrowser.Api/Library/LibraryService.cs index cf5014328..ecf3eb7db 100644 --- a/MediaBrowser.Api/Library/LibraryService.cs +++ b/MediaBrowser.Api/Library/LibraryService.cs @@ -1001,7 +1001,7 @@ namespace MediaBrowser.Api.Library } catch (Exception ex) { - Logger.LogError("Error refreshing library", ex); + Logger.LogError(ex, "Error refreshing library"); } }); } diff --git a/MediaBrowser.Api/Playback/BaseStreamingService.cs b/MediaBrowser.Api/Playback/BaseStreamingService.cs index 37cc8d2d7..af56f6382 100644 --- a/MediaBrowser.Api/Playback/BaseStreamingService.cs +++ b/MediaBrowser.Api/Playback/BaseStreamingService.cs @@ -278,7 +278,7 @@ namespace MediaBrowser.Api.Playback } catch (Exception ex) { - Logger.LogError("Error starting ffmpeg", ex); + Logger.LogError(ex, "Error starting ffmpeg"); ApiEntryPoint.Instance.OnTranscodeFailedToStart(outputPath, TranscodingJobType, state); @@ -372,7 +372,7 @@ namespace MediaBrowser.Api.Playback //} //catch (Exception ex) //{ - // Logger.LogError("Error disposing ffmpeg.", ex); + // Logger.LogError(ex, "Error disposing ffmpeg."); //} } diff --git a/MediaBrowser.Api/Playback/Hls/DynamicHlsService.cs b/MediaBrowser.Api/Playback/Hls/DynamicHlsService.cs index 7dda91e5a..5361e313c 100644 --- a/MediaBrowser.Api/Playback/Hls/DynamicHlsService.cs +++ b/MediaBrowser.Api/Playback/Hls/DynamicHlsService.cs @@ -367,7 +367,7 @@ namespace MediaBrowser.Api.Playback.Hls } catch (IOException ex) { - Logger.LogError("Error deleting partial stream file(s) {0}", ex, path); + Logger.LogError(ex, "Error deleting partial stream file(s) {path}", path); var task = Task.Delay(100); Task.WaitAll(task); @@ -375,7 +375,7 @@ namespace MediaBrowser.Api.Playback.Hls } catch (Exception ex) { - Logger.LogError("Error deleting partial stream file(s) {0}", ex, path); + Logger.LogError(ex, "Error deleting partial stream file(s) {path}", path); } } diff --git a/MediaBrowser.Api/Playback/StreamState.cs b/MediaBrowser.Api/Playback/StreamState.cs index 981a4725d..67fb04d0c 100644 --- a/MediaBrowser.Api/Playback/StreamState.cs +++ b/MediaBrowser.Api/Playback/StreamState.cs @@ -162,7 +162,7 @@ namespace MediaBrowser.Api.Playback } catch (Exception ex) { - _logger.LogError("Error disposing log stream", ex); + _logger.LogError(ex, "Error disposing log stream"); } LogFileStream = null; @@ -179,7 +179,7 @@ namespace MediaBrowser.Api.Playback } catch (Exception ex) { - _logger.LogError("Error disposing TranscodingThrottler", ex); + _logger.LogError(ex, "Error disposing TranscodingThrottler"); } TranscodingThrottler = null; @@ -196,7 +196,7 @@ namespace MediaBrowser.Api.Playback } catch (Exception ex) { - _logger.LogError("Error closing media source", ex); + _logger.LogError(ex, "Error closing media source"); } } } diff --git a/MediaBrowser.Api/Playback/TranscodingThrottler.cs b/MediaBrowser.Api/Playback/TranscodingThrottler.cs index 47f1f777a..5852852f6 100644 --- a/MediaBrowser.Api/Playback/TranscodingThrottler.cs +++ b/MediaBrowser.Api/Playback/TranscodingThrottler.cs @@ -69,7 +69,7 @@ namespace MediaBrowser.Api.Playback } catch (Exception ex) { - _logger.LogError("Error pausing transcoding", ex); + _logger.LogError(ex, "Error pausing transcoding"); } } } @@ -78,7 +78,7 @@ namespace MediaBrowser.Api.Playback { if (_isPaused) { - _logger.LogDebug("Sending unpause command to ffmpeg"); + _logger.LogDebug("Sending resume command to ffmpeg"); try { @@ -87,7 +87,7 @@ namespace MediaBrowser.Api.Playback } catch (Exception ex) { - _logger.LogError("Error unpausing transcoding", ex); + _logger.LogError(ex, "Error resuming transcoding"); } } } @@ -110,11 +110,11 @@ namespace MediaBrowser.Api.Playback if (gap < targetGap) { - //_logger.LogDebug("Not throttling transcoder gap {0} target gap {1}", gap, targetGap); + _logger.LogDebug("Not throttling transcoder gap {0} target gap {1}", gap, targetGap); return false; } - //_logger.LogDebug("Throttling transcoder gap {0} target gap {1}", gap, targetGap); + _logger.LogDebug("Throttling transcoder gap {0} target gap {1}", gap, targetGap); return true; } @@ -135,21 +135,21 @@ namespace MediaBrowser.Api.Playback if (gap < targetGap) { - //_logger.LogDebug("Not throttling transcoder gap {0} target gap {1} bytes downloaded {2}", gap, targetGap, bytesDownloaded); + _logger.LogDebug("Not throttling transcoder gap {0} target gap {1} bytes downloaded {2}", gap, targetGap, bytesDownloaded); return false; } - //_logger.LogDebug("Throttling transcoder gap {0} target gap {1} bytes downloaded {2}", gap, targetGap, bytesDownloaded); + _logger.LogDebug("Throttling transcoder gap {0} target gap {1} bytes downloaded {2}", gap, targetGap, bytesDownloaded); return true; } - catch + catch (Exception ex) { - //_logger.LogError("Error getting output size"); + _logger.LogError(ex, "Error getting output size"); return false; } } - //_logger.LogDebug("No throttle data for " + path); + _logger.LogDebug("No throttle data for " + path); return false; } diff --git a/MediaBrowser.Api/PluginService.cs b/MediaBrowser.Api/PluginService.cs index 33e6b2020..1f1bb3614 100644 --- a/MediaBrowser.Api/PluginService.cs +++ b/MediaBrowser.Api/PluginService.cs @@ -8,13 +8,13 @@ using MediaBrowser.Model.Entities; using MediaBrowser.Model.Plugins; using MediaBrowser.Model.Serialization; using System; -using System.Collections.Generic; using System.IO; using System.Linq; using System.Threading; using System.Threading.Tasks; using MediaBrowser.Model.Services; using MediaBrowser.Common.Plugins; +using Microsoft.Extensions.Logging; namespace MediaBrowser.Api { @@ -230,9 +230,9 @@ namespace MediaBrowser.Api .ToArray(); } } - catch + catch (Exception ex) { - //Logger.LogError("Error getting plugin list", ex); + Logger.LogError(ex, "Error getting plugin list"); // Play it safe here if (requireAppStoreEnabled) { diff --git a/MediaBrowser.Api/Subtitles/SubtitleService.cs b/MediaBrowser.Api/Subtitles/SubtitleService.cs index 9a149dc92..0e5b0a964 100644 --- a/MediaBrowser.Api/Subtitles/SubtitleService.cs +++ b/MediaBrowser.Api/Subtitles/SubtitleService.cs @@ -278,7 +278,7 @@ namespace MediaBrowser.Api.Subtitles } catch (Exception ex) { - Logger.LogError("Error downloading subtitles", ex); + Logger.LogError(ex, "Error downloading subtitles"); } }); |
