trace.c 568 Bytes
Newer Older
Edward Thomson committed
1 2 3 4 5 6 7
/*
 * Copyright (C) the libgit2 contributors. All rights reserved.
 *
 * This file is part of libgit2, distributed under the GNU GPL v2 with
 * a Linking Exception. For full terms see the included COPYING file.
 */

8 9
#include "trace.h"

10
#include "str.h"
11
#include "runtime.h"
Edward Thomson committed
12 13 14 15
#include "git2/trace.h"

struct git_trace_data git_trace__data = {0};

16
int git_trace_set(git_trace_level_t level, git_trace_cb callback)
Edward Thomson committed
17
{
Edward Thomson committed
18
	GIT_ASSERT_ARG(level == 0 || callback != NULL);
Edward Thomson committed
19 20 21 22

	git_trace__data.level = level;
	git_trace__data.callback = callback;
	GIT_MEMORY_BARRIER;
nulltoken committed
23

Edward Thomson committed
24 25
	return 0;
}