Logger for Windows 10 UWP app

Rashmin Javiya picture Rashmin Javiya · Oct 1, 2015 · Viewed 24.4k times · Source

I couldn't found any loggers for windows 10 universal app, i have tried out log4net, Microsoft enterprise library, Nlog but none of them are supported in windows 10 Universal platform.

Can anyone suggest me good logger for the windows 10 UWP?

Answer

talkitbr picture talkitbr · Oct 2, 2015

Have you tried MetroLog? You can install it using NuGet:

Install-Package MetroLog

Here's an quick example:

using MetroLog;
using MetroLog.Targets;

LogManagerFactory.DefaultConfiguration.AddTarget(LogLevel.Trace, LogLevel.Fatal, new FileStreamingTarget());

ILogger log = LogManagerFactory.DefaultLogManager.GetLogger<MainPage>();

log.Trace("This is a trace message.");

You can find a tutorial explaining how to add it on your project at http://talkitbr.com/2015/06/11/adicionando-logs-em-universal-apps. Also there is an explanation regarding retrieving these logs.