1 /*
2  * Copyright (C) the libgit2 contributors. All rights reserved.
3  *
4  * This file is part of libgit2, distributed under the GNU GPL v2 with
5  * a Linking Exception. For full terms see the included COPYING file.
6  */
7 module libgit2_d.trace;
8 
9 
10 /**
11  * @file git2/trace.h
12  * @brief Git tracing configuration routines
13  * @defgroup git_trace Git tracing configuration routines
14  * @ingroup Git
15  * @{
16  */
17 extern (C):
18 nothrow @nogc:
19 public:
20 
21 /**
22  * Available tracing levels.  When tracing is set to a particular level,
23  * callers will be provided tracing at the given level and all lower levels.
24  */
25 enum git_trace_level_t
26 {
27 	/**
28 	 * No tracing will be performed.
29 	 */
30 	GIT_TRACE_NONE = 0,
31 
32 	/**
33 	 * Severe errors that may impact the program's execution
34 	 */
35 	GIT_TRACE_FATAL = 1,
36 
37 	/**
38 	 * Errors that do not impact the program's execution
39 	 */
40 	GIT_TRACE_ERROR = 2,
41 
42 	/**
43 	 * Warnings that suggest abnormal data
44 	 */
45 	GIT_TRACE_WARN = 3,
46 
47 	/**
48 	 * Informational messages about program execution
49 	 */
50 	GIT_TRACE_INFO = 4,
51 
52 	/**
53 	 * Detailed data that allows for debugging
54 	 */
55 	GIT_TRACE_DEBUG = 5,
56 
57 	/**
58 	 * Exceptionally detailed debugging data
59 	 */
60 	GIT_TRACE_TRACE = 6,
61 }
62 
63 /**
64  * An instance for a tracing function
65  */
66 alias git_trace_cb = void function(.git_trace_level_t level, const (char)* msg);
67 
68 /**
69  * Sets the system tracing configuration to the specified level with the
70  * specified callback.  When system events occur at a level equal to, or
71  * lower than, the given level they will be reported to the given callback.
72  *
73  * Params:
74  *      level = Level to set tracing to
75  *      cb = Function to call with trace data
76  *
77  * Returns: 0 or an error code
78  */
79 //GIT_EXTERN
80 int git_trace_set(.git_trace_level_t level, .git_trace_cb cb);
81 
82 /** @} */