Skip to content
This repository was archived by the owner on Dec 5, 2019. It is now read-only.
Damian Hickey edited this page Apr 1, 2015 · 9 revisions

Copy LibLog.cs into your library and manually change the namespace OR install the nuget package which contains the source and which will automatically set the namespace to your project's root namespace (if using Visual Studio).

Using a logger inside your library.

public class MyClass
{
    private static readonly ILog Logger = LogProvider.For<MyClass>(); 
    
    public MyClass()
    {
        using(LogProvider.OpenNestedContext("message"))
        using(LogProvider.OpenMappedContext("key", "value"))
        {
            Logger.Info(....);
        }
    }
}

Consumers configuring a custom provider.

YourComponent.Logging.LogProvider.SetCurrentLogProvider(new CustomLogProvider())

Clone this wiki locally