mirror of
https://github.com/isar/libmdbx.git
synced 2025-01-31 14:08:20 +08:00
test: setup debug-loger for libmdbx.
Change-Id: I7235bd9457773cce2d20a371dcca47a5a4a61838
This commit is contained in:
parent
8167a08431
commit
38a6781321
21
test/test.cc
21
test/test.cc
@ -51,11 +51,30 @@ const char *status2str(actor_status status) {
|
|||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
static void mdbx_debug_logger(int type, const char *function, int line,
|
||||||
|
const char *msg, va_list args) {
|
||||||
|
loggging::loglevel level = loggging::trace;
|
||||||
|
if (type & MDBX_DBG_PRINT)
|
||||||
|
level = loggging::info;
|
||||||
|
if (type & MDBX_DBG_ASSERT) {
|
||||||
|
log_error("libmdbx assertion failure: %s, %d",
|
||||||
|
function ? function : "unknown", line);
|
||||||
|
level = loggging::failure;
|
||||||
|
}
|
||||||
|
|
||||||
|
output(level, msg, args);
|
||||||
|
if (type & MDBX_DBG_ASSERT)
|
||||||
|
abort();
|
||||||
|
}
|
||||||
|
|
||||||
void testcase::mdbx_prepare() {
|
void testcase::mdbx_prepare() {
|
||||||
log_trace(">> mdbx_prepare");
|
log_trace(">> mdbx_prepare");
|
||||||
|
|
||||||
|
int rc = mdbx_setup_debug(MDBX_DBG_DNT, mdbx_debug_logger, MDBX_DBG_DNT);
|
||||||
|
log_info("libmdbx debug-flags: 0x%02x", rc);
|
||||||
|
|
||||||
MDB_env *env = nullptr;
|
MDB_env *env = nullptr;
|
||||||
int rc = mdbx_env_create(&env);
|
rc = mdbx_env_create(&env);
|
||||||
if (rc != MDB_SUCCESS)
|
if (rc != MDB_SUCCESS)
|
||||||
failure_perror("mdbx_env_create()", rc);
|
failure_perror("mdbx_env_create()", rc);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user