Macros | |
#define | MDBX_LOGGER_DONTCHANGE ((MDBX_debug_func *)(intptr_t)-1) |
The "don't change `logger`" value for mdbx_setup_debug() More... | |
Typedefs | |
typedef enum MDBX_log_level_t | MDBX_log_level_t |
typedef enum MDBX_debug_flags_t | MDBX_debug_flags_t |
typedef void | MDBX_debug_func(MDBX_log_level_t loglevel, const char *function, int line, const char *fmt, va_list args) MDBX_CXX17_NOEXCEPT |
A debug-logger callback function, called before printing the message and aborting. More... | |
typedef void | MDBX_assert_func(const MDBX_env *env, const char *msg, const char *function, unsigned line) MDBX_CXX17_NOEXCEPT |
A callback function for most MDBX assert() failures, called before printing the message and aborting. More... | |
Enumerations | |
enum | MDBX_log_level_t { MDBX_LOG_FATAL = 0, MDBX_LOG_ERROR = 1, MDBX_LOG_WARN = 2, MDBX_LOG_NOTICE = 3, MDBX_LOG_VERBOSE = 4, MDBX_LOG_DEBUG = 5, MDBX_LOG_TRACE = 6, MDBX_LOG_EXTRA = 7, MDBX_LOG_DONTCHANGE = -1 } |
enum | MDBX_debug_flags_t { MDBX_DBG_NONE = 0, MDBX_DBG_ASSERT = 1, MDBX_DBG_AUDIT = 2, MDBX_DBG_JITTER = 4, MDBX_DBG_DUMP = 8, MDBX_DBG_LEGACY_MULTIOPEN = 16, MDBX_DBG_LEGACY_OVERLAP = 32, MDBX_DBG_DONT_UPGRADE = 64, MDBX_DBG_DONTCHANGE = -1 } |
Runtime debug flags. More... | |
Functions | |
LIBMDBX_API int | mdbx_setup_debug (MDBX_log_level_t log_level, MDBX_debug_flags_t debug_flags, MDBX_debug_func *logger) |
Setup global log-level, debug options and debug logger. More... | |
LIBMDBX_API int | mdbx_env_set_assert (MDBX_env *env, MDBX_assert_func *func) |
Set or reset the assert() callback of the environment. More... | |
const LIBMDBX_API char * | mdbx_dump_val (const MDBX_val *key, char *const buf, const size_t bufsize) |
Dump given MDBX_val to the buffer. More... | |
LIBMDBX_API void | mdbx_panic (const char *fmt,...) MDBX_PRINTF_ARGS(1 |
Panics with message and causes abnormal process termination. More... | |
#define MDBX_LOGGER_DONTCHANGE ((MDBX_debug_func *)(intptr_t)-1) |
The "don't change `logger`" value for mdbx_setup_debug()
typedef void MDBX_assert_func(const MDBX_env *env, const char *msg, const char *function, unsigned line) MDBX_CXX17_NOEXCEPT |
A callback function for most MDBX assert() failures, called before printing the message and aborting.
[in] | env | An environment handle returned by mdbx_env_create(). |
[in] | msg | The assertion message, not including newline. |
typedef enum MDBX_debug_flags_t MDBX_debug_flags_t |
typedef void MDBX_debug_func(MDBX_log_level_t loglevel, const char *function, int line, const char *fmt, va_list args) MDBX_CXX17_NOEXCEPT |
A debug-logger callback function, called before printing the message and aborting.
[in] | env | An environment handle returned by mdbx_env_create(). |
[in] | msg | The assertion message, not including newline. |
typedef enum MDBX_log_level_t MDBX_log_level_t |
enum MDBX_debug_flags_t |
Runtime debug flags.
MDBX_DBG_DUMP
and MDBX_DBG_LEGACY_MULTIOPEN
always have an effect, but MDBX_DBG_ASSERT
, MDBX_DBG_AUDIT
and MDBX_DBG_JITTER
only if libmdbx builded with MDBX_DEBUG.
Enumerator | |
---|---|
MDBX_DBG_NONE | |
MDBX_DBG_ASSERT | Enable assertion checks.
|
MDBX_DBG_AUDIT | Enable pages usage audit at commit transactions.
|
MDBX_DBG_JITTER | Enable small random delays in critical points.
|
MDBX_DBG_DUMP | Include or not meta-pages in coredump files.
|
MDBX_DBG_LEGACY_MULTIOPEN | Allow multi-opening environment(s) |
MDBX_DBG_LEGACY_OVERLAP | Allow read and write transactions overlapping for the same thread. |
MDBX_DBG_DONT_UPGRADE | Don't auto-upgrade format signature.
|
MDBX_DBG_DONTCHANGE | for mdbx_setup_debug() only: Don't change current settings |
enum MDBX_log_level_t |
Log level
Enumerator | |
---|---|
MDBX_LOG_FATAL | Critical conditions, i.e. assertion failures.
|
MDBX_LOG_ERROR | Enables logging for error conditions and MDBX_LOG_FATAL.
|
MDBX_LOG_WARN | Enables logging for warning conditions and MDBX_LOG_ERROR ... MDBX_LOG_FATAL.
|
MDBX_LOG_NOTICE | Enables logging for normal but significant condition and MDBX_LOG_WARN ... MDBX_LOG_FATAL.
|
MDBX_LOG_VERBOSE | Enables logging for verbose informational and MDBX_LOG_NOTICE ... MDBX_LOG_FATAL.
|
MDBX_LOG_DEBUG | Enables logging for debug-level messages and MDBX_LOG_VERBOSE ... MDBX_LOG_FATAL.
|
MDBX_LOG_TRACE | Enables logging for trace debug-level messages and MDBX_LOG_DEBUG ... MDBX_LOG_FATAL.
|
MDBX_LOG_EXTRA | Enables extra debug-level messages (dump pgno lists) and all other log-messages.
|
MDBX_LOG_DONTCHANGE | for mdbx_setup_debug() only: Don't change current settings |
const LIBMDBX_API char* mdbx_dump_val | ( | const MDBX_val * | key, |
char *const | buf, | ||
const size_t | bufsize | ||
) |
Dump given MDBX_val to the buffer.
Dumps it as string if value is printable (all bytes in the range 0x20..0x7E), otherwise made hexadecimal dump. Requires at least 4 byte length buffer.
LIBMDBX_API int mdbx_env_set_assert | ( | MDBX_env * | env, |
MDBX_assert_func * | func | ||
) |
Set or reset the assert() callback of the environment.
Does nothing if libmdbx was built with MDBX_DEBUG=0 or with NDEBUG, and will return MDBX_ENOSYS
in such case.
[in] | env | An environment handle returned by mdbx_env_create(). |
[in] | func | An MDBX_assert_func function, or 0. |
LIBMDBX_API void mdbx_panic | ( | const char * | fmt, |
... | |||
) |
Panics with message and causes abnormal process termination.
LIBMDBX_API int mdbx_setup_debug | ( | MDBX_log_level_t | log_level, |
MDBX_debug_flags_t | debug_flags, | ||
MDBX_debug_func * | logger | ||
) |
Setup global log-level, debug options and debug logger.
debug_flags
in the 0-15 bits and log_level
in the 16-31 bits.