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 /MediaBrowser.Controller/Entities | |
| parent | b0fd432126606d7008544ff0237beabc52109e02 (diff) | |
Use Microsoft.Extensions.Logging abstraction
Diffstat (limited to 'MediaBrowser.Controller/Entities')
| -rw-r--r-- | MediaBrowser.Controller/Entities/BaseItem.cs | 12 | ||||
| -rw-r--r-- | MediaBrowser.Controller/Entities/CollectionFolder.cs | 12 | ||||
| -rw-r--r-- | MediaBrowser.Controller/Entities/Folder.cs | 20 | ||||
| -rw-r--r-- | MediaBrowser.Controller/Entities/TV/Episode.cs | 2 | ||||
| -rw-r--r-- | MediaBrowser.Controller/Entities/UserViewBuilder.cs | 6 |
5 files changed, 27 insertions, 25 deletions
diff --git a/MediaBrowser.Controller/Entities/BaseItem.cs b/MediaBrowser.Controller/Entities/BaseItem.cs index e3b5b5117..9c0521753 100644 --- a/MediaBrowser.Controller/Entities/BaseItem.cs +++ b/MediaBrowser.Controller/Entities/BaseItem.cs @@ -12,7 +12,6 @@ using MediaBrowser.Model.Configuration; using MediaBrowser.Model.Dto; using MediaBrowser.Model.Entities; using MediaBrowser.Model.Library; -using MediaBrowser.Model.Logging; using MediaBrowser.Model.Users; using System; using System.Collections.Generic; @@ -36,6 +35,7 @@ using MediaBrowser.Model.Providers; using MediaBrowser.Model.Querying; using MediaBrowser.Model.Serialization; using MediaBrowser.Model.MediaInfo; +using Microsoft.Extensions.Logging; namespace MediaBrowser.Controller.Entities { @@ -798,7 +798,7 @@ namespace MediaBrowser.Controller.Entities builder.Append(chunkBuilder); } - //Logger.Debug("ModifySortChunks Start: {0} End: {1}", name, builder.ToString()); + //logger.LogDebug("ModifySortChunks Start: {0} End: {1}", name, builder.ToString()); return builder.ToString().RemoveDiacritics(); } @@ -1414,7 +1414,7 @@ namespace MediaBrowser.Controller.Entities } catch (Exception ex) { - Logger.ErrorException("Error refreshing owned items for {0}", ex, Path ?? Name); + Logger.LogError("Error refreshing owned items for {0}", ex, Path ?? Name); } } @@ -1802,7 +1802,7 @@ namespace MediaBrowser.Controller.Entities if (!isAllowed) { - Logger.Debug("{0} has an unrecognized parental rating of {1}.", Name, rating); + Logger.LogDebug("{0} has an unrecognized parental rating of {1}.", Name, rating); } return isAllowed; @@ -2058,7 +2058,7 @@ namespace MediaBrowser.Controller.Entities if (itemByPath == null) { - //Logger.Warn("Unable to find linked item at path {0}", info.Path); + //Logger.LogWarning("Unable to find linked item at path {0}", info.Path); } return itemByPath; @@ -2070,7 +2070,7 @@ namespace MediaBrowser.Controller.Entities if (item == null) { - //Logger.Warn("Unable to find linked item at path {0}", info.Path); + //Logger.LogWarning("Unable to find linked item at path {0}", info.Path); } return item; diff --git a/MediaBrowser.Controller/Entities/CollectionFolder.cs b/MediaBrowser.Controller/Entities/CollectionFolder.cs index 19a8c24b8..dbec03a21 100644 --- a/MediaBrowser.Controller/Entities/CollectionFolder.cs +++ b/MediaBrowser.Controller/Entities/CollectionFolder.cs @@ -1,13 +1,13 @@ -using MediaBrowser.Controller.IO; -using MediaBrowser.Controller.Library; -using MediaBrowser.Controller.Providers; -using System; +using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Threading; using System.Threading.Tasks; +using MediaBrowser.Controller.IO; +using MediaBrowser.Controller.Library; +using MediaBrowser.Controller.Providers; using MediaBrowser.Controller.Configuration; using MediaBrowser.Model.Configuration; using MediaBrowser.Model.Entities; @@ -15,6 +15,8 @@ using MediaBrowser.Model.Extensions; using MediaBrowser.Model.IO; using MediaBrowser.Model.Serialization; +using Microsoft.Extensions.Logging; + namespace MediaBrowser.Controller.Entities { /// <summary> @@ -103,7 +105,7 @@ namespace MediaBrowser.Controller.Entities } catch (Exception ex) { - Logger.ErrorException("Error loading library options", ex); + Logger.LogError("Error loading library options", ex); return new LibraryOptions(); } diff --git a/MediaBrowser.Controller/Entities/Folder.cs b/MediaBrowser.Controller/Entities/Folder.cs index 81072b6e7..3d830cbe6 100644 --- a/MediaBrowser.Controller/Entities/Folder.cs +++ b/MediaBrowser.Controller/Entities/Folder.cs @@ -10,7 +10,6 @@ using System.IO; using System.Linq; using System.Threading; using System.Threading.Tasks; - using MediaBrowser.Controller.Channels; using MediaBrowser.Controller.Dto; using MediaBrowser.Controller.Entities.Audio; @@ -23,6 +22,7 @@ using MediaBrowser.Model.Serialization; using MediaBrowser.Model.Extensions; using MediaBrowser.Controller.Collections; using MediaBrowser.Controller.Configuration; +using Microsoft.Extensions.Logging; namespace MediaBrowser.Controller.Entities { @@ -264,7 +264,7 @@ namespace MediaBrowser.Controller.Entities /// </summary> protected virtual List<BaseItem> LoadChildren() { - //Logger.Debug("Loading children from {0} {1} {2}", GetType().Name, Id, Path); + //logger.LogDebug("Loading children from {0} {1} {2}", GetType().Name, Id, Path); //just load our children from the repo - the library will be validated and maintained in other processes return GetCachedChildren(); } @@ -303,7 +303,7 @@ namespace MediaBrowser.Controller.Entities var id = child.Id; if (dictionary.ContainsKey(id)) { - Logger.Error("Found folder containing items with duplicate id. Path: {0}, Child Name: {1}", + Logger.LogError("Found folder containing items with duplicate id. Path: {0}, Child Name: {1}", Path ?? Name, child.Path ?? child.Name); } @@ -425,7 +425,7 @@ namespace MediaBrowser.Controller.Entities else { - Logger.Debug("Removed item: " + item.Path); + Logger.LogDebug("Removed item: " + item.Path); item.SetParent(null); LibraryManager.DeleteItem(item, new DeleteOptions { DeleteFileLocation = false }, this, false); @@ -795,7 +795,7 @@ namespace MediaBrowser.Controller.Entities { if (!(this is ICollectionFolder)) { - Logger.Debug("Query requires post-filtering due to LinkedChildren. Type: " + GetType().Name); + Logger.LogDebug("Query requires post-filtering due to LinkedChildren. Type: " + GetType().Name); return true; } } @@ -846,7 +846,7 @@ namespace MediaBrowser.Controller.Entities if (CollapseBoxSetItems(query, this, query.User, ConfigurationManager)) { - Logger.Debug("Query requires post-filtering due to CollapseBoxSetItems"); + Logger.LogDebug("Query requires post-filtering due to CollapseBoxSetItems"); return true; } @@ -1575,7 +1575,7 @@ namespace MediaBrowser.Controller.Entities { try { - Logger.Debug("Found shortcut at {0}", i.FullName); + Logger.LogDebug("Found shortcut at {0}", i.FullName); var resolvedPath = CollectionFolder.ApplicationHost.ExpandVirtualPath(FileSystem.ResolveShortcut(i.FullName)); @@ -1588,13 +1588,13 @@ namespace MediaBrowser.Controller.Entities }; } - Logger.Error("Error resolving shortcut {0}", i.FullName); + Logger.LogError("Error resolving shortcut {0}", i.FullName); return null; } catch (IOException ex) { - Logger.ErrorException("Error resolving shortcut {0}", ex, i.FullName); + Logger.LogError("Error resolving shortcut {0}", ex, i.FullName); return null; } }) @@ -1605,7 +1605,7 @@ namespace MediaBrowser.Controller.Entities if (!newShortcutLinks.SequenceEqual(currentShortcutLinks, new LinkedChildComparer(FileSystem))) { - Logger.Info("Shortcut links have changed for {0}", Path); + Logger.LogInformation("Shortcut links have changed for {0}", Path); newShortcutLinks.AddRange(LinkedChildren.Where(i => i.Type == LinkedChildType.Manual)); LinkedChildren = newShortcutLinks.ToArray(); diff --git a/MediaBrowser.Controller/Entities/TV/Episode.cs b/MediaBrowser.Controller/Entities/TV/Episode.cs index 201579731..cdf0214d3 100644 --- a/MediaBrowser.Controller/Entities/TV/Episode.cs +++ b/MediaBrowser.Controller/Entities/TV/Episode.cs @@ -363,7 +363,7 @@ namespace MediaBrowser.Controller.Entities.TV } catch (Exception ex) { - Logger.ErrorException("Error in FillMissingEpisodeNumbersFromPath. Episode: {0}", ex, Path ?? Name ?? Id.ToString()); + Logger.LogError(ex, "Error in FillMissingEpisodeNumbersFromPath. Episode: {Episode}", Path ?? Name ?? Id.ToString()); } } } diff --git a/MediaBrowser.Controller/Entities/UserViewBuilder.cs b/MediaBrowser.Controller/Entities/UserViewBuilder.cs index 36035a2bb..6d5126a44 100644 --- a/MediaBrowser.Controller/Entities/UserViewBuilder.cs +++ b/MediaBrowser.Controller/Entities/UserViewBuilder.cs @@ -5,7 +5,7 @@ using MediaBrowser.Controller.Library; using MediaBrowser.Controller.Playlists; using MediaBrowser.Controller.TV; using MediaBrowser.Model.Entities; -using MediaBrowser.Model.Logging; +using Microsoft.Extensions.Logging; using MediaBrowser.Model.Querying; using System; using System.Collections.Generic; @@ -262,7 +262,7 @@ namespace MediaBrowser.Controller.Entities catch { // Full exception logged at lower levels - _logger.Error("Error getting genre"); + _logger.LogError("Error getting genre"); return null; } @@ -386,7 +386,7 @@ namespace MediaBrowser.Controller.Entities catch { // Full exception logged at lower levels - _logger.Error("Error getting genre"); + _logger.LogError("Error getting genre"); return null; } |
