test callback function
1 static void tracer(TraceLevel level, in char[] msg) 2 { 3 import std.stdio; 4 stderr.writefln("Level(%s): %s", level, msg); 5 } 6 7 try 8 { 9 setGitTracer(TraceLevel.trace, &tracer); 10 } 11 catch (GitException exc) 12 { 13 assert(exc.msg == _noTraceMsg, exc.msg); 14 }
test callback delegate
1 struct S 2 { 3 size_t line = 1; 4 5 void tracer(TraceLevel level, in char[] msg) 6 { 7 import std.stdio; 8 stderr.writefln("Level(%s): Line %s - %s", line++, level, msg); 9 } 10 } 11 12 S s; 13 14 try 15 { 16 setGitTracer(TraceLevel.trace, &s.tracer); 17 } 18 catch (GitException exc) 19 { 20 assert(exc.msg == _noTraceMsg, exc.msg); 21 }
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.