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 //Declaration name in C language 64 enum 65 { 66 GIT_TRACE_NONE = .git_trace_level_t.GIT_TRACE_NONE, 67 GIT_TRACE_FATAL = .git_trace_level_t.GIT_TRACE_FATAL, 68 GIT_TRACE_ERROR = .git_trace_level_t.GIT_TRACE_ERROR, 69 GIT_TRACE_WARN = .git_trace_level_t.GIT_TRACE_WARN, 70 GIT_TRACE_INFO = .git_trace_level_t.GIT_TRACE_INFO, 71 GIT_TRACE_DEBUG = .git_trace_level_t.GIT_TRACE_DEBUG, 72 GIT_TRACE_TRACE = .git_trace_level_t.GIT_TRACE_TRACE, 73 } 74 75 /** 76 * An instance for a tracing function 77 */ 78 alias git_trace_cb = void function(.git_trace_level_t level, const (char)* msg); 79 80 /** 81 * Sets the system tracing configuration to the specified level with the 82 * specified callback. When system events occur at a level equal to, or 83 * lower than, the given level they will be reported to the given callback. 84 * 85 * Params: 86 * level = Level to set tracing to 87 * cb = Function to call with trace data 88 * 89 * Returns: 0 or an error code 90 */ 91 //GIT_EXTERN 92 int git_trace_set(.git_trace_level_t level, .git_trace_cb cb); 93 94 /** @} */