Skip to content

NLog/NLog.Owin.Logging

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 
 
 

NLog.Owin.Logging

Build status codecov.io Version

NLog logging adapter for OWIN!

Installation

There's a nuget package you can install this way:

Install-Package NLog.Owin.Logging

Currently there are dependencies on:

Target framework Dependencies
.NET 4.5 NLog (>= 5.0.0.0), Owin (>= 1.0)

Using

To use the NLogAdapter with its default configuration:

using NLog.Owin.Logging;

public class Startup
{
	public void Configuration(IAppBuilder app)
	{
		app.UseNLog();
	}
}

The default translation table is:

TraceEventType NLog Loglevel
Critical Fatal
Error Error
Warning Warn
Information Info
Verbose Trace
Start Debug
Stop Debug
Suspend Debug
Resume Debug
Transfer Debug

If you'd like to customize this translation table you can supply a Func<TraceEventType, LogLevel> to the extension above.

using NLog.Owin.Logging;
using NLog;
using System.Diagnostics;

public class Startup
{
	public void Configuration(IAppBuilder app)
	{
		// make a warning out of every log message!
		app.UseNLog((eventType) => LogLevel.Warn);
	}
}

Note / Information

(Added in version 1.1) Any EventId passed to this Microsoft.Owin.Logging.ILogger.WriteCore() implementation is passed down to NLog in the log event's properties, and can be written to output by adding the matching line in the Log appender layout:

${event-properties:item=EventId}

You can find more information about this topic in: https://github.com/NLog/NLog/wiki/EventProperties-Layout-Renderer

Help / Contribution

If you found a bug, please create an issue. Want to contribute? Create a pull request!

About

NLog logging adapter for OWIN

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages