Introduce tracing

libgit2 has a simple tracing infrastructure that allows somebody to add tracing to the library, hook up a listener for trace events and then do with them as they please.  (There is no tracing in the library itself, but a consumer is trying to troubleshoot a problem, this allows them to throw some tracing in at problem areas and deploy a new build to capture some information about what might be going wrong.)

We use this from time to time when we have a difficult-to-reproduce problem and want to capture diagnostics about it.  It would be very nice if LibGit2Sharp:

1. Provided the mechanism for hooking up tracing information in libgit2 itself and handled the marshalling for us, and
2. Had a mechanism that allowed LibGit2Sharp users to provide tracing information in a similar manner.

Here we have a mechanism for sending trace information, for example:

    GlobalSetting.TraceConfiguration = new TraceConfiguration(TraceLevel.Debug, (l, m) => {
        Console.WriteLine("{0} [{1}] {2}", DateTime.Now, l, m);
    });

    Trace.Write(TraceLevel.Info, "This will be sent to the trace listener since Info is a higher (more important) level than Debug, which is configured.");
    Trace.Write(TraceLevel.Trace, "This is the noisiest level, and will not be sent to the listener since the configuration only requests Debug information.");

    // We can guard expensive traces so that they will only occur if tracing is enabled.
    if (Trace.IsEnabled(TraceLevel.Trace))
    {
        // Costly thing goes here
        Trace.Write(TraceLevel.Trace, "Foo!");
    }
Thanks for clarifying... I thought the current code looked pretty good. :grinning: