line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
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
|
|
|
|
|
|
|
#ifndef INCLUDE_trace_h__ |
8
|
|
|
|
|
|
|
#define INCLUDE_trace_h__ |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
#include "common.h" |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
#include |
13
|
|
|
|
|
|
|
#include "str.h" |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
struct git_trace_data { |
16
|
|
|
|
|
|
|
git_trace_level_t level; |
17
|
|
|
|
|
|
|
git_trace_cb callback; |
18
|
|
|
|
|
|
|
}; |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
extern struct git_trace_data git_trace__data; |
21
|
|
|
|
|
|
|
|
22
|
0
|
|
|
|
|
|
GIT_INLINE(void) git_trace__write_fmt( |
23
|
|
|
|
|
|
|
git_trace_level_t level, |
24
|
|
|
|
|
|
|
const char *fmt, |
25
|
|
|
|
|
|
|
va_list ap) |
26
|
|
|
|
|
|
|
{ |
27
|
0
|
|
|
|
|
|
git_trace_cb callback = git_trace__data.callback; |
28
|
0
|
|
|
|
|
|
git_str message = GIT_STR_INIT; |
29
|
|
|
|
|
|
|
|
30
|
0
|
|
|
|
|
|
git_str_vprintf(&message, fmt, ap); |
31
|
|
|
|
|
|
|
|
32
|
0
|
|
|
|
|
|
callback(level, git_str_cstr(&message)); |
33
|
|
|
|
|
|
|
|
34
|
0
|
|
|
|
|
|
git_str_dispose(&message); |
35
|
0
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
#define git_trace_level() (git_trace__data.level) |
38
|
|
|
|
|
|
|
|
39
|
0
|
|
|
|
|
|
GIT_INLINE(void) git_trace(git_trace_level_t level, const char *fmt, ...) |
40
|
|
|
|
|
|
|
{ |
41
|
0
|
0
|
|
|
|
|
if (git_trace__data.level >= level && |
|
|
0
|
|
|
|
|
|
42
|
0
|
|
|
|
|
|
git_trace__data.callback != NULL) { |
43
|
|
|
|
|
|
|
va_list ap; |
44
|
|
|
|
|
|
|
|
45
|
0
|
|
|
|
|
|
va_start(ap, fmt); |
46
|
0
|
|
|
|
|
|
git_trace__write_fmt(level, fmt, ap); |
47
|
0
|
|
|
|
|
|
va_end(ap); |
48
|
|
|
|
|
|
|
} |
49
|
0
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
#endif |