test callback function
static void tracer(TraceLevel level, in char[] msg) { import std.stdio; stderr.writefln("Level(%s): %s", level, msg); } try { setGitTracer(TraceLevel.trace, &tracer); } catch (GitException exc) { assert(exc.msg == _noTraceMsg, exc.msg); }
test callback delegate
struct S { size_t line = 1; void tracer(TraceLevel level, in char[] msg) { import std.stdio; stderr.writefln("Level(%s): Line %s - %s", line++, level, msg); } } S s; try { setGitTracer(TraceLevel.trace, &s.tracer); } catch (GitException exc) { assert(exc.msg == _noTraceMsg, exc.msg); }
Sets the git system tracing configuration to the specified level with the specified callback. When system events occur at a level equal to, or lower than, the given level they will be reported to the given callback.
Note: If libgit2 is not built with tracing support calling this function will throw a GitException.
Make sure -DGIT_TRACE is set when building libgit2 to enable tracing support, or look at the libgit2 build instructions.