This .NET library defines an event that triggers whenever a log record is sent to NLog. It provides an easy to use API for intercepting logs.
- Add a nuget dependency on NLog.Events.
- Define a target with type
OnLogEventin yourNLog.config, and a rule that sends some logs to it. - Subscribe to
NLogEvents.Events.OnLogevent. It'll fire whenever a log record is sent to theOnLogEventyou've defined.
See Example.