diff options
| author | LukePulverenti <luke.pulverenti@gmail.com> | 2013-02-21 16:06:23 -0500 |
|---|---|---|
| committer | LukePulverenti <luke.pulverenti@gmail.com> | 2013-02-21 16:06:23 -0500 |
| commit | 76f067f86778c29fbfb3716a72bc858cfdd73fd8 (patch) | |
| tree | 3a61a3203860993a0742f1c4c169d874b5f85000 /MediaBrowser.Common/Net/WebSocketConnection.cs | |
| parent | 2a2ee4adb379344b9eb7262ccc59778dc277e1ae (diff) | |
extracted more logging dependancies
Diffstat (limited to 'MediaBrowser.Common/Net/WebSocketConnection.cs')
| -rw-r--r-- | MediaBrowser.Common/Net/WebSocketConnection.cs | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/MediaBrowser.Common/Net/WebSocketConnection.cs b/MediaBrowser.Common/Net/WebSocketConnection.cs index ca12d07be..24b8e2a9f 100644 --- a/MediaBrowser.Common/Net/WebSocketConnection.cs +++ b/MediaBrowser.Common/Net/WebSocketConnection.cs @@ -37,7 +37,7 @@ namespace MediaBrowser.Common.Net /// <summary> /// The logger /// </summary> - private static readonly ILogger Logger = LogManager.GetLogger("WebSocketConnection"); + private readonly ILogger _logger; /// <summary> /// Initializes a new instance of the <see cref="WebSocketConnection" /> class. @@ -46,7 +46,7 @@ namespace MediaBrowser.Common.Net /// <param name="remoteEndPoint">The remote end point.</param> /// <param name="receiveAction">The receive action.</param> /// <exception cref="System.ArgumentNullException">socket</exception> - public WebSocketConnection(IWebSocket socket, EndPoint remoteEndPoint, Action<WebSocketMessageInfo> receiveAction) + public WebSocketConnection(IWebSocket socket, EndPoint remoteEndPoint, Action<WebSocketMessageInfo> receiveAction, ILogger logger) { if (socket == null) { @@ -60,10 +60,15 @@ namespace MediaBrowser.Common.Net { throw new ArgumentNullException("receiveAction"); } + if (logger == null) + { + throw new ArgumentNullException("logger"); + } _socket = socket; _socket.OnReceiveDelegate = info => OnReceive(info, receiveAction); RemoteEndPoint = remoteEndPoint; + _logger = logger; } /// <summary> @@ -81,7 +86,7 @@ namespace MediaBrowser.Common.Net } catch (Exception ex) { - Logger.ErrorException("Error processing web socket message", ex); + _logger.ErrorException("Error processing web socket message", ex); } } @@ -148,13 +153,13 @@ namespace MediaBrowser.Common.Net } catch (OperationCanceledException) { - Logger.Info("WebSocket message to {0} was cancelled", RemoteEndPoint); + _logger.Info("WebSocket message to {0} was cancelled", RemoteEndPoint); throw; } catch (Exception ex) { - Logger.ErrorException("Error sending WebSocket message {0}", ex, RemoteEndPoint); + _logger.ErrorException("Error sending WebSocket message {0}", ex, RemoteEndPoint); throw; } |
