NLog Logging Adapter - Tigra-Astronomy/TA.Utilities GitHub Wiki
We have produced an adapter that implements our abstract logging interfaces and uses NLog as its logging back-end.
The adapter is package in a separate nuget package, so that we don't have to force you to take a dependency on NLog to use our utilities or logging interfaces.
Install-Package TA.Utils.Logging.NLog
Simply create an instance of the log service and pass it to your code wherever it is needed.
using TA.Utils.Core.Diagnostics;
using TA.Utils.Logging.NLog;
// ...
ILog log = new LogService();
MyApp.RunMyCode(log);
log.Info().Message("All done").Write();
log.Shutdown(); // flush buffers
Or, configure your dependency injection framework. For Ninject we would do something like:
using TA.Utils.Core.Diagnostics;
using TA.Utils.Logging.NLog;
internal class LoggingModule : NinjectModule
{
public override void Load()
{
Bind<ILog>().To<LoggingService>().InSingletonScope();
}
}