From 12c2f7193facd25ed2b4188bb608c431494b0e96 Mon Sep 17 00:00:00 2001 From: "kay.one" Date: Wed, 9 Nov 2011 21:30:51 -0800 Subject: [PATCH] Better fix for Prowl logging issues. --- .../Providers/ExternalNotification/Prowl.cs | 6 ++--- NzbDrone.Core/Providers/GrowlProvider.cs | 3 +-- NzbDrone.Core/Providers/ProwlProvider.cs | 23 +++++++------------ 3 files changed, 11 insertions(+), 21 deletions(-) diff --git a/NzbDrone.Core/Providers/ExternalNotification/Prowl.cs b/NzbDrone.Core/Providers/ExternalNotification/Prowl.cs index f43a3b400..f81068241 100644 --- a/NzbDrone.Core/Providers/ExternalNotification/Prowl.cs +++ b/NzbDrone.Core/Providers/ExternalNotification/Prowl.cs @@ -10,8 +10,6 @@ namespace NzbDrone.Core.Providers.ExternalNotification { private readonly ProwlProvider _prowlProvider; - private readonly Logger Logger = LogManager.GetCurrentClassLogger(); - public Prowl(ConfigProvider configProvider, ProwlProvider prowlProvider) : base(configProvider) { @@ -41,7 +39,7 @@ namespace NzbDrone.Core.Providers.ExternalNotification catch (Exception ex) { - Logger.WarnException(ex.Message, ex); + _logger.WarnException(ex.Message, ex); throw; } } @@ -64,7 +62,7 @@ namespace NzbDrone.Core.Providers.ExternalNotification catch (Exception ex) { - Logger.WarnException(ex.Message, ex); + _logger.WarnException(ex.Message, ex); throw; } } diff --git a/NzbDrone.Core/Providers/GrowlProvider.cs b/NzbDrone.Core/Providers/GrowlProvider.cs index cc1dd44db..05cd42942 100644 --- a/NzbDrone.Core/Providers/GrowlProvider.cs +++ b/NzbDrone.Core/Providers/GrowlProvider.cs @@ -1,7 +1,6 @@ using System; using System.Collections.Generic; using System.Linq; -using System.Text; using Growl.Connector; using NLog; @@ -9,7 +8,7 @@ namespace NzbDrone.Core.Providers { public class GrowlProvider { - private readonly Logger Logger = LogManager.GetCurrentClassLogger(); + private static readonly Logger Logger = LogManager.GetCurrentClassLogger(); private readonly Application _growlApplication = new Application("NzbDrone"); private GrowlConnector _growlConnector; diff --git a/NzbDrone.Core/Providers/ProwlProvider.cs b/NzbDrone.Core/Providers/ProwlProvider.cs index a43626ea4..463d13c90 100644 --- a/NzbDrone.Core/Providers/ProwlProvider.cs +++ b/NzbDrone.Core/Providers/ProwlProvider.cs @@ -1,7 +1,5 @@ using System; -using System.Collections.Generic; using System.Linq; -using System.Text; using NLog; using Prowlin; @@ -9,12 +7,7 @@ namespace NzbDrone.Core.Providers { public class ProwlProvider { - private readonly Logger Logger = LogManager.GetCurrentClassLogger(); - - public ProwlProvider() - { - - } + private static readonly Logger Logger = LogManager.GetCurrentClassLogger(); public virtual bool Verify(string apiKey) { @@ -32,7 +25,7 @@ namespace NzbDrone.Core.Providers return true; } - catch(Exception ex) + catch (Exception ex) { Logger.TraceException(ex.Message, ex); Logger.Warn("Invalid API Key: {0}", apiKey); @@ -47,11 +40,11 @@ namespace NzbDrone.Core.Providers { var notification = new Notification { - Application = "NzbDrone", - Description = message, - Event = title, - Priority = priority, - Url = url + Application = "NzbDrone", + Description = message, + Event = title, + Priority = priority, + Url = url }; foreach (var apiKey in apiKeys.Split(',')) @@ -67,7 +60,7 @@ namespace NzbDrone.Core.Providers return true; } - catch(Exception ex) + catch (Exception ex) { Logger.TraceException(ex.Message, ex); Logger.Warn("Invalid API Key(s): {0}", apiKeys);