From b95fb5b124be848dead47217b01fa451794754c3 Mon Sep 17 00:00:00 2001 From: Leonid Yuriev Date: Wed, 13 Nov 2019 03:20:25 +0300 Subject: [PATCH] mdbx: add auxiliary debug-begin/debug-end includes. Change-Id: I9fad95e7e73a581c49388da31895aed94a3abbe4 --- src/elements/debug_begin.h | 34 ++++++++++++++++++++++++++++++++++ src/elements/debug_end.h | 7 +++++++ src/elements/internals.h | 6 ------ 3 files changed, 41 insertions(+), 6 deletions(-) create mode 100644 src/elements/debug_begin.h create mode 100644 src/elements/debug_end.h diff --git a/src/elements/debug_begin.h b/src/elements/debug_begin.h new file mode 100644 index 00000000..f3306b5d --- /dev/null +++ b/src/elements/debug_begin.h @@ -0,0 +1,34 @@ +#pragma push_macro("mdbx_trace") +#pragma push_macro("mdbx_debug") +#pragma push_macro("mdbx_verbose") +#pragma push_macro("mdbx_notice") +#pragma push_macro("mdbx_warning") +#pragma push_macro("mdbx_error") +#pragma push_macro("mdbx_assert") + +#undef mdbx_trace +#define mdbx_trace(fmt, ...) \ + mdbx_debug_log(MDBX_LOG_TRACE, __func__, __LINE__, fmt "\n", __VA_ARGS__) + +#undef mdbx_debug +#define mdbx_debug(fmt, ...) \ + mdbx_debug_log(MDBX_LOG_DEBUG, __func__, __LINE__, fmt "\n", __VA_ARGS__) + +#undef mdbx_verbose +#define mdbx_verbose(fmt, ...) \ + mdbx_debug_log(MDBX_LOG_VERBOSE, __func__, __LINE__, fmt "\n", __VA_ARGS__) + +#undef mdbx_notice +#define mdbx_notice(fmt, ...) \ + mdbx_debug_log(MDBX_LOG_NOTICE, __func__, __LINE__, fmt "\n", __VA_ARGS__) + +#undef mdbx_warning +#define mdbx_warning(fmt, ...) \ + mdbx_debug_log(MDBX_LOG_WARN, __func__, __LINE__, fmt "\n", __VA_ARGS__) + +#undef mdbx_error +#define mdbx_error(fmt, ...) \ + mdbx_debug_log(MDBX_LOG_ERROR, __func__, __LINE__, fmt "\n", __VA_ARGS__) + +#undef mdbx_assert +#define mdbx_assert(env, expr) mdbx_ensure(env, expr) diff --git a/src/elements/debug_end.h b/src/elements/debug_end.h new file mode 100644 index 00000000..e361119b --- /dev/null +++ b/src/elements/debug_end.h @@ -0,0 +1,7 @@ +#pragma pop_macro("mdbx_trace") +#pragma pop_macro("mdbx_debug") +#pragma pop_macro("mdbx_verbose") +#pragma pop_macro("mdbx_notice") +#pragma pop_macro("mdbx_warning") +#pragma pop_macro("mdbx_error") +#pragma pop_macro("mdbx_assert") diff --git a/src/elements/internals.h b/src/elements/internals.h index 2404d972..0289cb5c 100644 --- a/src/elements/internals.h +++ b/src/elements/internals.h @@ -1080,12 +1080,6 @@ MDBX_INTERNAL_FUNC void mdbx_assert_fail(const MDBX_env *env, const char *msg, __VA_ARGS__); \ } while (0) -#define mdbx_debug_print(fmt, ...) \ - do { \ - if (mdbx_log_enabled(MDBX_LOG_DEBUG)) \ - mdbx_debug_log(MDBX_LOG_DEBUG, NULL, 0, fmt, __VA_ARGS__); \ - } while (0) - #define mdbx_verbose(fmt, ...) \ do { \ if (mdbx_log_enabled(MDBX_LOG_VERBOSE)) \