Repository navigation
Using
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).
public class MyClass
{
private static readonly ILog Logger = LogProvider.For<MyClass>();
public MyClass()
{
using(LogProvider.OpenNestedContext("message"))
using(LogProvider.OpenMappedContext("key", "value"))
{
Logger.Info(....);
}
}
}By default only your code will only be able to get a logger from within your library (assuming it's a single assembly). This is by design to prevent consumers of your library creating unintended coupling your library's log provider.
From their perspective, intellisense will look like this:

If you have a scenario where you have a single "core" project in a solution and you want LibLog's various GetLogger() methods available to other projects in your solutions, consider first using [InternalsVisibleTo] attribute.
Alternatively you may optionally make the various GetLogger() public by defining LIBLOG_PUBLIC conditional compilation symbol. Your consumer's intellisense will look like this:

** Be wary though of your consumers potentially creating unintended coupling your library's log provider. **
Diagnostic contexts can be opened from the LogProvider:
using (logProvider.OpenNestedContext("nestedmessage"))
{
//...
}
using (logProvider.OpenMappedContext("key", "value"))
{
//...
}