Using NLog as OWIN logger

BTW. there’s some news about that topic: My NLog OWIN adapter went “official”

While playing around with OWIN, WebAPI 2 and the other new kids I was missing a logger factory for my favorite logging framework: NLog! And I wouldn’t be a good software engineer if I didn’t wire this up in a nice tiny library.

There you go: Pysco68.Owin.Logging.NLogAdapter on GitHub

And to make it a breeze I built a Nuget package for this one! That means that you can now use NLog as logger for your next OWIN project just by doing this:

Voila! If you’d like to customize the log-level translation table just take a look at the Github page!

Note: this is not a logging middleware! If you want some of those Google is your friend. The log factory (it’s an implementation of Microsoft.Owin.Logging.ILoggerFactory in fact) does provide an implementation of ILogger that wraps arround NLog.There’s some pretty good information about the architecture at Tugber Kugurlu’s blog / introduction to OWIN Logging.

I really hope you enjoy this one! Leave a comment if you have any question or suggestions! Contributions are welcome, just fork and create a pull request, I’ll review it for sure!

Hey! Sharing's great for your karma ;)
Tweet about this on TwitterShare on Facebook0Share on Google+0Pin on Pinterest0Email this to someone

About Yannic

Yannic is a daytime freelance software developer, inventor and full-time geek. There's not much technical stuff he wouldn't like to crack open to see how they work. As a perfectionist most of the things he's getting into are completed in the most fashionable manner.