Blame include/git2/trace.h

Packit ae9e2a
/*
Packit ae9e2a
 * Copyright (C) the libgit2 contributors. All rights reserved.
Packit ae9e2a
 *
Packit ae9e2a
 * This file is part of libgit2, distributed under the GNU GPL v2 with
Packit ae9e2a
 * a Linking Exception. For full terms see the included COPYING file.
Packit ae9e2a
 */
Packit ae9e2a
#ifndef INCLUDE_git_trace_h__
Packit ae9e2a
#define INCLUDE_git_trace_h__
Packit ae9e2a
Packit ae9e2a
#include "common.h"
Packit ae9e2a
#include "types.h"
Packit ae9e2a
Packit ae9e2a
/**
Packit ae9e2a
 * @file git2/trace.h
Packit ae9e2a
 * @brief Git tracing configuration routines
Packit ae9e2a
 * @defgroup git_trace Git tracing configuration routines
Packit ae9e2a
 * @ingroup Git
Packit ae9e2a
 * @{
Packit ae9e2a
 */
Packit ae9e2a
GIT_BEGIN_DECL
Packit ae9e2a
Packit ae9e2a
/**
Packit ae9e2a
 * Available tracing levels.  When tracing is set to a particular level,
Packit ae9e2a
 * callers will be provided tracing at the given level and all lower levels.
Packit ae9e2a
 */
Packit ae9e2a
typedef enum {
Packit ae9e2a
	/** No tracing will be performed. */
Packit ae9e2a
	GIT_TRACE_NONE = 0,
Packit ae9e2a
Packit ae9e2a
	/** Severe errors that may impact the program's execution */
Packit ae9e2a
	GIT_TRACE_FATAL = 1,
Packit ae9e2a
Packit ae9e2a
	/** Errors that do not impact the program's execution */
Packit ae9e2a
	GIT_TRACE_ERROR = 2,
Packit ae9e2a
Packit ae9e2a
	/** Warnings that suggest abnormal data */
Packit ae9e2a
	GIT_TRACE_WARN = 3,
Packit ae9e2a
Packit ae9e2a
	/** Informational messages about program execution */
Packit ae9e2a
	GIT_TRACE_INFO = 4,
Packit ae9e2a
Packit ae9e2a
	/** Detailed data that allows for debugging */
Packit ae9e2a
	GIT_TRACE_DEBUG = 5,
Packit ae9e2a
Packit ae9e2a
	/** Exceptionally detailed debugging data */
Packit ae9e2a
	GIT_TRACE_TRACE = 6
Packit ae9e2a
} git_trace_level_t;
Packit ae9e2a
Packit ae9e2a
/**
Packit ae9e2a
 * An instance for a tracing function
Packit ae9e2a
 */
Packit ae9e2a
typedef void (*git_trace_callback)(git_trace_level_t level, const char *msg);
Packit ae9e2a
Packit ae9e2a
/**
Packit ae9e2a
 * Sets the system tracing configuration to the specified level with the
Packit ae9e2a
 * specified callback.  When system events occur at a level equal to, or
Packit ae9e2a
 * lower than, the given level they will be reported to the given callback.
Packit ae9e2a
 *
Packit ae9e2a
 * @param level Level to set tracing to
Packit ae9e2a
 * @param cb Function to call with trace data
Packit ae9e2a
 * @return 0 or an error code
Packit ae9e2a
 */
Packit ae9e2a
GIT_EXTERN(int) git_trace_set(git_trace_level_t level, git_trace_callback cb);
Packit ae9e2a
Packit ae9e2a
/** @} */
Packit ae9e2a
GIT_END_DECL
Packit ae9e2a
#endif