From 2a67f794ee0f35bb0e9bbfd269eac15c12c6f976 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Tue, 17 Jul 2018 12:48:47 +0300 Subject: added error logger for libmdbx --- libs/libmdbx/libmdbx.vcxproj | 2 +- plugins/Dbx_mdbx/src/init.cpp | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/libs/libmdbx/libmdbx.vcxproj b/libs/libmdbx/libmdbx.vcxproj index ea7e127144..6c9a5d07d3 100644 --- a/libs/libmdbx/libmdbx.vcxproj +++ b/libs/libmdbx/libmdbx.vcxproj @@ -26,7 +26,7 @@ - MDBX_CONFIG_MANUAL_TLS_CALLBACK=1;LIBMDBX_EXPORTS;%(PreprocessorDefinitions) + MDBX_CONFIG_MANUAL_TLS_CALLBACK=1;MDBX_DEBUG=1;LIBMDBX_EXPORTS;%(PreprocessorDefinitions) diff --git a/plugins/Dbx_mdbx/src/init.cpp b/plugins/Dbx_mdbx/src/init.cpp index 391fe88b56..a7b69ed1ad 100644 --- a/plugins/Dbx_mdbx/src/init.cpp +++ b/plugins/Dbx_mdbx/src/init.cpp @@ -51,6 +51,15 @@ extern "C" __declspec(dllexport) const MUUID MirandaInterfaces[] = { MIID_DATABA ///////////////////////////////////////////////////////////////////////////////////////// +static void logger(int type, const char *function, int line, const char *msg, va_list args) +{ + char tmp[4096]; + _vsnprintf_s(tmp, _countof(tmp), msg, args); + Netlib_Logf(nullptr, "MDBX[%d] (%s, %d): %s", type, function, line, tmp); +} + +///////////////////////////////////////////////////////////////////////////////////////// + // returns 0 if the profile is created, EMKPRF* static int makeDatabase(const TCHAR *profile) { @@ -90,6 +99,7 @@ static DATABASELINK dblink = int CMPlugin::Load() { + mdbx_setup_debug(MDBX_DBG_ASSERT | MDBX_DBG_PRINT, &logger); RegisterDatabasePlugin(&dblink); return 0; } -- cgit v1.2.3