Skip to content

Commit 611fbf8

Browse files
author
Stephan Dilly
authored
enable tracing and add tracing types and func (#730)
* enable tracing and add tracing types and func * fix return value
1 parent 7d12405 commit 611fbf8

File tree

2 files changed

+30
-0
lines changed

2 files changed

+30
-0
lines changed

Diff for: libgit2-sys/build.rs

+1
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@ fn main() {
107107
features.push_str("#ifndef INCLUDE_features_h\n");
108108
features.push_str("#define INCLUDE_features_h\n");
109109
features.push_str("#define GIT_THREADS 1\n");
110+
features.push_str("#define GIT_TRACE 1\n");
110111

111112
if !target.contains("android") {
112113
features.push_str("#define GIT_USE_NSEC 1\n");

Diff for: libgit2-sys/lib.rs

+29
Original file line numberDiff line numberDiff line change
@@ -1892,6 +1892,33 @@ pub const GIT_WORKTREE_PRUNE_OPTIONS_VERSION: c_uint = 1;
18921892
pub type git_repository_mergehead_foreach_cb =
18931893
Option<extern "C" fn(oid: *const git_oid, payload: *mut c_void) -> c_int>;
18941894

1895+
git_enum! {
1896+
pub enum git_trace_level_t {
1897+
/* No tracing will be performed. */
1898+
GIT_TRACE_NONE = 0,
1899+
1900+
/* Severe errors that may impact the program's execution */
1901+
GIT_TRACE_FATAL = 1,
1902+
1903+
/* Errors that do not impact the program's execution */
1904+
GIT_TRACE_ERROR = 2,
1905+
1906+
/* Warnings that suggest abnormal data */
1907+
GIT_TRACE_WARN = 3,
1908+
1909+
/* Informational messages about program execution */
1910+
GIT_TRACE_INFO = 4,
1911+
1912+
/* Detailed data that allows for debugging */
1913+
GIT_TRACE_DEBUG = 5,
1914+
1915+
/* Exceptionally detailed debugging data */
1916+
GIT_TRACE_TRACE = 6,
1917+
}
1918+
}
1919+
1920+
pub type git_trace_cb = Option<extern "C" fn(level: git_trace_level_t, msg: *const c_char)>;
1921+
18951922
extern "C" {
18961923
// threads
18971924
pub fn git_libgit2_init() -> c_int;
@@ -3986,6 +4013,8 @@ extern "C" {
39864013
replace_name: *const c_char,
39874014
replace_email: *const c_char,
39884015
) -> c_int;
4016+
4017+
pub fn git_trace_set(level: git_trace_level_t, cb: git_trace_cb) -> c_int;
39894018
}
39904019

39914020
pub fn init() {

0 commit comments

Comments
 (0)