]>
Commit | Line | Data |
---|---|---|
b5ec5430 ET |
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 | #include "buffer.h" | |
9 | #include "common.h" | |
10 | #include "global.h" | |
11 | #include "trace.h" | |
12 | #include "git2/trace.h" | |
13 | ||
14 | #ifdef GIT_TRACE | |
15 | ||
16 | struct git_trace_data git_trace__data = {0}; | |
17 | ||
18 | #endif | |
19 | ||
20 | int git_trace_set(git_trace_level_t level, git_trace_callback callback) | |
21 | { | |
22 | #ifdef GIT_TRACE | |
23 | assert(level == 0 || callback != NULL); | |
24 | ||
25 | git_trace__data.level = level; | |
26 | git_trace__data.callback = callback; | |
27 | GIT_MEMORY_BARRIER; | |
1fed6b07 | 28 | |
b5ec5430 ET |
29 | return 0; |
30 | #else | |
31 | GIT_UNUSED(level); | |
32 | GIT_UNUSED(callback); | |
33 | ||
34 | giterr_set(GITERR_INVALID, | |
35 | "This version of libgit2 was not built with tracing."); | |
36 | return -1; | |
37 | #endif | |
38 | } |