diff options
Diffstat (limited to 'include/git2/trace.h')
-rw-r--r-- | include/git2/trace.h | 43 |
1 files changed, 30 insertions, 13 deletions
diff --git a/include/git2/trace.h b/include/git2/trace.h index f9b4d6ff6..867b34612 100644 --- a/include/git2/trace.h +++ b/include/git2/trace.h @@ -20,47 +20,64 @@ GIT_BEGIN_DECL /** - * Available tracing levels. When tracing is set to a particular level, - * callers will be provided tracing at the given level and all lower levels. + * Available tracing messages. Each tracing level can be enabled + * independently or pass GIT_TRACE_ALL to enable all levels. */ typedef enum { /** No tracing will be performed. */ - GIT_TRACE_NONE = 0, + GIT_TRACE_NONE = 0x0000u, + + /** All tracing messages will be sent. */ + GIT_TRACE_ALL = 0xFFFFu, /** Severe errors that may impact the program's execution */ - GIT_TRACE_FATAL = 1, + GIT_TRACE_FATAL = 0x0001u, /** Errors that do not impact the program's execution */ - GIT_TRACE_ERROR = 2, + GIT_TRACE_ERROR = 0x0002u, + GIT_TRACE_ERROR_AND_BELOW = 0x0003u, /** Warnings that suggest abnormal data */ - GIT_TRACE_WARN = 3, + GIT_TRACE_WARN = 0x0004u, + GIT_TRACE_WARN_AND_BELOW = 0x0007u, /** Informational messages about program execution */ - GIT_TRACE_INFO = 4, + GIT_TRACE_INFO = 0x0008u, + GIT_TRACE_INFO_AND_BELOW = 0x000Fu, /** Detailed data that allows for debugging */ - GIT_TRACE_DEBUG = 5, + GIT_TRACE_DEBUG = 0x0010u, /** Exceptionally detailed debugging data */ - GIT_TRACE_TRACE = 6 + GIT_TRACE_TRACE = 0x0020u, + + /** Performance tracking related traces */ + GIT_TRACE_PERF = 0x0040u, } git_trace_level_t; /** * An instance for a tracing function */ -typedef void (*git_trace_callback)(git_trace_level_t level, const char *msg); +typedef void (*git_trace_callback)( + git_trace_level_t level, /* just one bit will be sent */ + void *cb_payload, + void *msg_payload, + const char *msg); /** * Sets the system tracing configuration to the specified level with the * specified callback. When system events occur at a level equal to, or * lower than, the given level they will be reported to the given callback. * - * @param level Level to set tracing to - * @param cb Function to call with trace data + * @param level Bitmask of all enabled trace levels + * @param cb Function to call with trace messages + * @param cb_payload Payload to pass when callback is invoked * @return 0 or an error code */ -GIT_EXTERN(int) git_trace_set(git_trace_level_t level, git_trace_callback cb); +GIT_EXTERN(int) git_trace_set( + git_trace_level_t level, + git_trace_callback cb, + void *cb_payload); /** @} */ GIT_END_DECL |