It is a Fay Logging facade for the NLog 4 logging framework. This facade povides a simple delegate logging API making logging easier, while helping to make sure any of the code required to generate a log message is not executed unless the logging level is within scope.
Below is a simplified example for logging. A more robust implementation may use a service locator or dependency inject framework to initialize the logger.
// Initialize logger someplace
IDelegateLogger<string> logger = new NLogSimpleLogger(LogManager.GetCurrentClassLogger());
// Use logger as needed
logger.Critical(() => string.Format("Some text blah {0} blah", "blah"));
logger.Verbose(() =>
{
StringBuilder builder = new StringBuilder();
builder.Append("Foo");
builder.Append(" ");
builder.Append("Bar");
return builder.ToString();
});
// When application is done needing the logger its recommend to dispose it
logger.Dispose();
Fey Logging is available via NuGet:
- [Fay Logging NLog4] (https://www.nuget.org/packages/Fay.Logging.NLog4/)