Blame include/git2/trace.h

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