Tracer is a minimalist unified tracing/logging interface that abstracts the specific logging libraries from consuming code.
C# Pascal PowerShell Puppet
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
.nuget
Tracer.Console
Tracer.EntLib
Tracer.Interfaces
Tracer.Log4Net
Tracer.NLog
Tracer.Realtime
Tracer.SystemDiagnostics
Tracer.UnitTests
icon
.gitattributes
.gitignore
Common.ps1
Drop.ps1
LICENSE
Push.ps1
README.md
Tracer.licenseheader
Tracer.sln
Tracer.targets
Tracer.vssettings
nuget.exe

README.md

Icon NuTracer

NuTracer is a minimalist unified tracing/logging interface that abstracts the specific logging libraries from consuming code. This allows you to start coding your projects right away without having to buy into a logging framework up-front, but still start building a strong foundation of tracing messages that will help diagnose problems down the road.

It's designed to optimize the existing capabilities of the underlying libraries without compromising their performance or features.

It provides adapters for System.Diagnostics, log4net, NLog and Enterprise Library Logging.

Why

Tracing or logging is something everyone needs to consider and adopt from day one in any application. Having to decide on a specific framework or library up-front, and spreading that implementation-specific code throughout the code base is simply too risky. Why not just start with the simplest possible abstraction and decide on the implementation later and in a single place, the bootstrapping/app start?

Where

You can get Tracer at:

Fork it on GitHub.

How

As elaborated in the introductory blog post, it's not worth it to introduce a binary dependency for something that is really extremely simple (just 3 types). So you install via nuget the main interfaces in your "Common" or "Core" project which is shared by the components that will do the logging, by using:

install-package tracer

and then use the following code to retrieve a tracer and log to it:

public class MyComponent
{
    private static readonly ITracer tracer = Tracer.Get<MyComponent>();

    public void DoSomething()
    {
        tracer.Info("Doing something...");
        ...
    }
}

Your bootstrapper or application startup code will take a dependency on a concrete adapter implementation mentioned in the Where section, and initialize the Tracer with the following line:

Tracer.Initialize(new TracerManager());

And that would be all!

All source code will be in your own project namespaces, and made internal by default. It's up to you to make it public or not!

You can read more about NuTracer in the Wiki.