aboutsummaryrefslogtreecommitdiff
path: root/Mono.Nat
diff options
context:
space:
mode:
authorBond_009 <bond.009@outlook.com>2018-12-13 14:18:25 +0100
committerBond_009 <bond.009@outlook.com>2018-12-30 22:44:38 +0100
commit0f8b3c634708ce8e7b2e2ae6fed87b6b943b5bca (patch)
tree3b2440977592f46598ee1961199ec2c0fd3455ac /Mono.Nat
parentb0fd432126606d7008544ff0237beabc52109e02 (diff)
Use Microsoft.Extensions.Logging abstraction
Diffstat (limited to 'Mono.Nat')
-rw-r--r--Mono.Nat/NatManager.cs2
-rw-r--r--Mono.Nat/Pmp/PmpNatDevice.cs8
-rw-r--r--Mono.Nat/Pmp/PmpSearcher.cs4
-rw-r--r--Mono.Nat/Upnp/Messages/GetServicesMessage.cs6
-rw-r--r--Mono.Nat/Upnp/Searchers/UpnpSearcher.cs4
-rw-r--r--Mono.Nat/Upnp/UpnpNatDevice.cs22
6 files changed, 23 insertions, 23 deletions
diff --git a/Mono.Nat/NatManager.cs b/Mono.Nat/NatManager.cs
index 752fd0416..3ed01a6b3 100644
--- a/Mono.Nat/NatManager.cs
+++ b/Mono.Nat/NatManager.cs
@@ -4,7 +4,7 @@ using System.Collections.Generic;
using System.Threading.Tasks;
using MediaBrowser.Common.Net;
using MediaBrowser.Model.Dlna;
-using MediaBrowser.Model.Logging;
+using Microsoft.Extensions.Logging;
using System.Linq;
namespace Mono.Nat
diff --git a/Mono.Nat/Pmp/PmpNatDevice.cs b/Mono.Nat/Pmp/PmpNatDevice.cs
index dc0e2c89b..99d030207 100644
--- a/Mono.Nat/Pmp/PmpNatDevice.cs
+++ b/Mono.Nat/Pmp/PmpNatDevice.cs
@@ -32,7 +32,7 @@ using System.Threading;
using System.Collections.Generic;
using System.Threading.Tasks;
using MediaBrowser.Model.Extensions;
-using MediaBrowser.Model.Logging;
+using Microsoft.Extensions.Logging;
namespace Mono.Nat.Pmp
{
@@ -132,7 +132,7 @@ namespace Mono.Nat.Pmp
mapping.Protocol,
mapping.PrivatePort,
e.Message);
- _logger.Debug(message);
+ _logger.LogDebug(message);
throw e;
}
@@ -183,7 +183,7 @@ namespace Mono.Nat.Pmp
};
var errorMsg = errors[resultCode];
- _logger.Debug("Error in CreatePortMapListen: " + errorMsg);
+ _logger.LogDebug("Error in CreatePortMapListen: " + errorMsg);
return;
}
@@ -198,7 +198,7 @@ namespace Mono.Nat.Pmp
}
catch (Exception ex)
{
- _logger.ErrorException("Error in CreatePortMapListen", ex);
+ _logger.LogError("Error in CreatePortMapListen", ex);
return;
}
}
diff --git a/Mono.Nat/Pmp/PmpSearcher.cs b/Mono.Nat/Pmp/PmpSearcher.cs
index 180fb48d7..98cf37f14 100644
--- a/Mono.Nat/Pmp/PmpSearcher.cs
+++ b/Mono.Nat/Pmp/PmpSearcher.cs
@@ -37,7 +37,7 @@ using Mono.Nat.Pmp;
using System.Net.NetworkInformation;
using System.Net.Sockets;
using System.Threading.Tasks;
-using MediaBrowser.Model.Logging;
+using Microsoft.Extensions.Logging;
using System.Linq;
namespace Mono.Nat
@@ -208,7 +208,7 @@ namespace Mono.Nat
return;
int errorcode = IPAddress.NetworkToHostOrder(BitConverter.ToInt16(response, 2));
if (errorcode != 0)
- _logger.Debug("Non zero error: {0}", errorcode);
+ _logger.LogDebug("Non zero error: {0}", errorcode);
IPAddress publicIp = new IPAddress(new byte[] { response[8], response[9], response[10], response[11] });
nextSearch = DateTime.Now.AddMinutes(5);
diff --git a/Mono.Nat/Upnp/Messages/GetServicesMessage.cs b/Mono.Nat/Upnp/Messages/GetServicesMessage.cs
index 3395b7596..4b765fd42 100644
--- a/Mono.Nat/Upnp/Messages/GetServicesMessage.cs
+++ b/Mono.Nat/Upnp/Messages/GetServicesMessage.cs
@@ -28,7 +28,7 @@ using System;
using System.Diagnostics;
using System.Net;
using MediaBrowser.Common.Net;
-using MediaBrowser.Model.Logging;
+using Microsoft.Extensions.Logging;
namespace Mono.Nat.Upnp
{
@@ -42,10 +42,10 @@ namespace Mono.Nat.Upnp
: base(null)
{
if (string.IsNullOrEmpty(description))
- _logger.Warn("Description is null");
+ _logger.LogWarning("Description is null");
if (hostAddress == null)
- _logger.Warn("hostaddress is null");
+ _logger.LogWarning("hostaddress is null");
this.servicesDescriptionUrl = description;
this.hostAddress = hostAddress;
diff --git a/Mono.Nat/Upnp/Searchers/UpnpSearcher.cs b/Mono.Nat/Upnp/Searchers/UpnpSearcher.cs
index 7c1e89d3b..e9e47a91e 100644
--- a/Mono.Nat/Upnp/Searchers/UpnpSearcher.cs
+++ b/Mono.Nat/Upnp/Searchers/UpnpSearcher.cs
@@ -37,7 +37,7 @@ using System.Diagnostics;
using System.Net.Sockets;
using System.Net.NetworkInformation;
using MediaBrowser.Common.Net;
-using MediaBrowser.Model.Logging;
+using Microsoft.Extensions.Logging;
using MediaBrowser.Model.Dlna;
using System.Threading.Tasks;
@@ -90,7 +90,7 @@ namespace Mono.Nat
}
catch (Exception ex)
{
- _logger.ErrorException("Error decoding device response", ex);
+ _logger.LogError("Error decoding device response", ex);
}
}
diff --git a/Mono.Nat/Upnp/UpnpNatDevice.cs b/Mono.Nat/Upnp/UpnpNatDevice.cs
index cae7f5fc8..62539103a 100644
--- a/Mono.Nat/Upnp/UpnpNatDevice.cs
+++ b/Mono.Nat/Upnp/UpnpNatDevice.cs
@@ -34,7 +34,7 @@ using System.Text;
using System.Diagnostics;
using System.Threading.Tasks;
using MediaBrowser.Common.Net;
-using MediaBrowser.Model.Logging;
+using Microsoft.Extensions.Logging;
using MediaBrowser.Model.Dlna;
namespace Mono.Nat.Upnp
@@ -77,7 +77,7 @@ namespace Mono.Nat.Upnp
// Are we going to get addresses with the "http://" attached?
if (locationDetails.StartsWith("http://", StringComparison.OrdinalIgnoreCase))
{
- _logger.Debug("Found device at: {0}", locationDetails);
+ _logger.LogDebug("Found device at: {0}", locationDetails);
// This bit strings out the "http://" from the string
locationDetails = locationDetails.Substring(7);
@@ -89,7 +89,7 @@ namespace Mono.Nat.Upnp
}
else
{
- _logger.Debug("Couldn't decode address. Please send following string to the developer: ");
+ _logger.LogDebug("Couldn't decode address. Please send following string to the developer: ");
}
}
@@ -116,7 +116,7 @@ namespace Mono.Nat.Upnp
{
if (response.StatusCode != HttpStatusCode.OK)
{
- _logger.Debug("{0}: Couldn't get services list: {1}", HostEndPoint, response.StatusCode);
+ _logger.LogDebug("{0}: Couldn't get services list: {1}", HostEndPoint, response.StatusCode);
return; // FIXME: This the best thing to do??
}
@@ -139,7 +139,7 @@ namespace Mono.Nat.Upnp
{
return;
}
- _logger.Debug("{0}: Couldn't parse services list", HostEndPoint);
+ _logger.LogDebug("{0}: Couldn't parse services list", HostEndPoint);
System.Threading.Thread.Sleep(10);
}
}
@@ -155,14 +155,14 @@ namespace Mono.Nat.Upnp
{
//If the service is a WANIPConnection, then we have what we want
string type = service["serviceType"].InnerText;
- _logger.Debug("{0}: Found service: {1}", HostEndPoint, type);
+ _logger.LogDebug("{0}: Found service: {1}", HostEndPoint, type);
// TODO: Add support for version 2 of UPnP.
if (string.Equals(type, "urn:schemas-upnp-org:service:WANPPPConnection:1", StringComparison.OrdinalIgnoreCase) ||
string.Equals(type, "urn:schemas-upnp-org:service:WANIPConnection:1", StringComparison.OrdinalIgnoreCase))
{
this.controlUrl = service["controlURL"].InnerText;
- _logger.Debug("{0}: Found upnp service at: {1}", HostEndPoint, controlUrl);
+ _logger.LogDebug("{0}: Found upnp service at: {1}", HostEndPoint, controlUrl);
Uri u;
if (Uri.TryCreate(controlUrl, UriKind.RelativeOrAbsolute, out u))
@@ -174,15 +174,15 @@ namespace Mono.Nat.Upnp
if (IPAddress.TryParse(u.Host, out parsedHostIpAddress))
{
this.hostEndPoint = new IPEndPoint(parsedHostIpAddress, u.Port);
- //_logger.Debug("{0}: Absolute URI detected. Host address is now: {1}", old, HostEndPoint);
+ //_logger.LogDebug("{0}: Absolute URI detected. Host address is now: {1}", old, HostEndPoint);
this.controlUrl = controlUrl.Substring(u.GetLeftPart(UriPartial.Authority).Length);
- //_logger.Debug("{0}: New control url: {1}", HostEndPoint, controlUrl);
+ //_logger.LogDebug("{0}: New control url: {1}", HostEndPoint, controlUrl);
}
}
}
else
{
- _logger.Debug("{0}: Assuming control Uri is relative: {1}", HostEndPoint, controlUrl);
+ _logger.LogDebug("{0}: Assuming control Uri is relative: {1}", HostEndPoint, controlUrl);
}
return;
}
@@ -266,4 +266,4 @@ namespace Mono.Nat.Upnp
this.hostEndPoint, "Manually Check" /*this.GetExternalIP()*/, this.controlUrl, this.serviceDescriptionUrl, this.serviceType, this.LastSeen);
}
}
-} \ No newline at end of file
+}