Mute debug from package
DaveShep opened this issue · comments
Is there an option or a compilation constant I can use to mute the debug msgs from this nuget package?
Hi,
If you instantiate the publisher using one of the constructors that accept an ISsdpLogger instance, you can pass the static NullLogger.Instance value for that argument, and the logging will not occur. Alternatively you can pass your own implementation of the ISsdpLogger interface if you want to log elsewhere or filter the logging.
Something like this should work (you can replace System.Net.IPAddress.Any.ToString() with a string containing the local IP address if you want).
var publisher = new Rssdp.SsdpDevicePublisher
(
new Rssdp.Infrastructure.SsdpCommunicationsServer
(
new Rssdp.SocketFactory(System.Net.IPAddress.Any.ToString())
),
Rssdp.NullLogger.Instance
);
No problem. In hindsight it should be easier, but I was trying to avoid global config and the constructors got a bit messy over time as I added features. One day I might get around to cleaning them up.