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 --- plugins/Dbx_mdbx/src/init.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'plugins') 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