From 0b3e4c48f751a8e817830b276a780b0d5cb75e18 Mon Sep 17 00:00:00 2001 From: Mark McDowall Date: Wed, 4 Jun 2014 21:20:58 -0700 Subject: [PATCH] Added some logging to PlexServerProxy --- .../Notifications/Plex/PlexServerProxy.cs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/NzbDrone.Core/Notifications/Plex/PlexServerProxy.cs b/src/NzbDrone.Core/Notifications/Plex/PlexServerProxy.cs index 726cac410..d9c1102b4 100644 --- a/src/NzbDrone.Core/Notifications/Plex/PlexServerProxy.cs +++ b/src/NzbDrone.Core/Notifications/Plex/PlexServerProxy.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.IO; using System.Linq; using Newtonsoft.Json.Linq; +using NLog; using NzbDrone.Common; using NzbDrone.Common.Cache; using NzbDrone.Common.Serializer; @@ -19,10 +20,12 @@ namespace NzbDrone.Core.Notifications.Plex public class PlexServerProxy : IPlexServerProxy { private readonly ICached _authCache; + private readonly Logger _logger; - public PlexServerProxy(ICacheManager cacheManager) + public PlexServerProxy(ICacheManager cacheManager, Logger logger) { _authCache = cacheManager.GetCache(GetType(), "authCache"); + _logger = logger; } public List GetTvSections(PlexServerSettings settings) @@ -32,6 +35,9 @@ namespace NzbDrone.Core.Notifications.Plex var response = client.Execute(request); + CheckForError(response.Content); + _logger.Trace("Sections response: {0}", response.Content); + return Json.Deserialize(response.Content) .Directories .Where(d => d.Type == "show") @@ -45,6 +51,9 @@ namespace NzbDrone.Core.Notifications.Plex var client = GetPlexServerClient(settings); var response = client.Execute(request); + + CheckForError(response.Content); + _logger.Trace("Update response: {0}", response.Content); } private String Authenticate(string username, string password) @@ -53,6 +62,7 @@ namespace NzbDrone.Core.Notifications.Plex var client = GetMyPlexClient(username, password); var response = client.Execute(request); + CheckForError(response.Content); var user = Json.Deserialize(JObject.Parse(response.Content).SelectToken("user").ToString());