Skip to content

Latest commit

 

History

History
40 lines (29 loc) · 1.19 KB

README.md

File metadata and controls

40 lines (29 loc) · 1.19 KB

Common Logger <-> Serilog

NuGet version Build status

Provides a bridge from the old to the new logging systems.

Usage

Configure app.config/web.config file of your project:

<configSections>
	<sectionGroup name="common">
		<section name="logging" type="Common.Logging.ConfigurationSectionHandler, Common.Logging" />
	</sectionGroup>
</configSections>

<common>
	<logging>
  		<factoryAdapter type="Common.Logging.Serilog.SerilogFactoryAdapter, Common.Logging.Serilog" />
	</logging>
</common>

You must configure and provide a global logger to use this adapter:

var log = new LoggerConfiguration()
    .WriteTo.ColoredConsole()
    .CreateLogger();

// set global instance of Serilog logger which Common.Logger.Serilog requires.
Log.Logger = log;

Links