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/Security/PluginSecurityManager.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/Security/PluginSecurityManager.cs')
| -rw-r--r-- | Emby.Server.Implementations/Security/PluginSecurityManager.cs | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/Emby.Server.Implementations/Security/PluginSecurityManager.cs b/Emby.Server.Implementations/Security/PluginSecurityManager.cs index 8d8d6700e..2b1494c39 100644 --- a/Emby.Server.Implementations/Security/PluginSecurityManager.cs +++ b/Emby.Server.Implementations/Security/PluginSecurityManager.cs @@ -12,7 +12,7 @@ using MediaBrowser.Controller; using MediaBrowser.Model.Cryptography; using MediaBrowser.Model.Entities; using MediaBrowser.Model.IO; -using MediaBrowser.Model.Logging; +using Microsoft.Extensions.Logging; using MediaBrowser.Model.Net; using MediaBrowser.Model.Serialization; @@ -51,7 +51,7 @@ namespace Emby.Server.Implementations.Security /// Initializes a new instance of the <see cref="PluginSecurityManager" /> class. /// </summary> public PluginSecurityManager(IServerApplicationHost appHost, IHttpClient httpClient, IJsonSerializer jsonSerializer, - IApplicationPaths appPaths, ILogManager logManager, IFileSystem fileSystem, ICryptoProvider cryptographyProvider) + IApplicationPaths appPaths, ILoggerFactory loggerFactory, IFileSystem fileSystem, ICryptoProvider cryptographyProvider) { if (httpClient == null) { @@ -64,7 +64,7 @@ namespace Emby.Server.Implementations.Security _appPaths = appPaths; _fileSystem = fileSystem; _cryptographyProvider = cryptographyProvider; - _logger = logManager.GetLogger("SecurityManager"); + _logger = loggerFactory.CreateLogger("SecurityManager"); } /// <summary> @@ -135,7 +135,7 @@ namespace Emby.Server.Implementations.Security if (reg == null) { var msg = "Result from appstore registration was null."; - _logger.Error(msg); + _logger.LogError(msg); throw new ArgumentException(msg); } if (!String.IsNullOrEmpty(reg.key)) @@ -150,18 +150,15 @@ namespace Emby.Server.Implementations.Security SaveAppStoreInfo(parameters); throw; } - catch (HttpException e) + catch (HttpException ex) { - _logger.ErrorException("Error registering appstore purchase {0}", e, parameters ?? "NO PARMS SENT"); + _logger.LogError(ex, "Error registering appstore purchase {parameters}", parameters ?? "NO PARMS SENT"); - if (e.StatusCode.HasValue && e.StatusCode.Value == HttpStatusCode.PaymentRequired) - { - } throw new Exception("Error registering store sale"); } - catch (Exception e) + catch (Exception ex) { - _logger.ErrorException("Error registering appstore purchase {0}", e, parameters ?? "NO PARMS SENT"); + _logger.LogError(ex, "Error registering appstore purchase {parameters}", parameters ?? "NO PARMS SENT"); SaveAppStoreInfo(parameters); //TODO - could create a re-try routine on start-up if this file is there. For now we can handle manually. throw new Exception("Error registering store sale"); |
