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 /** 8 * License: GPL-2.0(Linking Exception) 9 */ 10 module libgit2.trace; 11 12 13 private import libgit2.common: GIT_EXTERN; 14 15 /* 16 * @file git2/trace.h 17 * @brief Git tracing configuration routines 18 * @defgroup git_trace Git tracing configuration routines 19 * @ingroup Git 20 * @{ 21 */ 22 extern (C): 23 nothrow @nogc: 24 public: 25 26 /** 27 * Available tracing levels. When tracing is set to a particular level, 28 * callers will be provided tracing at the given level and all lower levels. 29 */ 30 enum git_trace_level_t 31 { 32 /** 33 * No tracing will be performed. 34 */ 35 GIT_TRACE_NONE = 0, 36 37 /** 38 * Severe errors that may impact the program's execution 39 */ 40 GIT_TRACE_FATAL = 1, 41 42 /** 43 * Errors that do not impact the program's execution 44 */ 45 GIT_TRACE_ERROR = 2, 46 47 /** 48 * Warnings that suggest abnormal data 49 */ 50 GIT_TRACE_WARN = 3, 51 52 /** 53 * Informational messages about program execution 54 */ 55 GIT_TRACE_INFO = 4, 56 57 /** 58 * Detailed data that allows for debugging 59 */ 60 GIT_TRACE_DEBUG = 5, 61 62 /** 63 * Exceptionally detailed debugging data 64 */ 65 GIT_TRACE_TRACE = 6, 66 } 67 68 //Declaration name in C language 69 enum 70 { 71 GIT_TRACE_NONE = .git_trace_level_t.GIT_TRACE_NONE, 72 GIT_TRACE_FATAL = .git_trace_level_t.GIT_TRACE_FATAL, 73 GIT_TRACE_ERROR = .git_trace_level_t.GIT_TRACE_ERROR, 74 GIT_TRACE_WARN = .git_trace_level_t.GIT_TRACE_WARN, 75 GIT_TRACE_INFO = .git_trace_level_t.GIT_TRACE_INFO, 76 GIT_TRACE_DEBUG = .git_trace_level_t.GIT_TRACE_DEBUG, 77 GIT_TRACE_TRACE = .git_trace_level_t.GIT_TRACE_TRACE, 78 } 79 80 /** 81 * An instance for a tracing function 82 */ 83 alias git_trace_cb = void function(.git_trace_level_t level, const (char)* msg); 84 85 /** 86 * Sets the system tracing configuration to the specified level with the 87 * specified callback. When system events occur at a level equal to, or 88 * lower than, the given level they will be reported to the given callback. 89 * 90 * Params: 91 * level = Level to set tracing to 92 * cb = Function to call with trace data 93 * 94 * Returns: 0 or an error code 95 */ 96 @GIT_EXTERN 97 int git_trace_set(.git_trace_level_t level, .git_trace_cb cb); 98 99 /* @} */