summaryrefslogtreecommitdiff
path: root/plugins/Dbx_mdbx
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2018-07-17 12:48:47 +0300
committerGeorge Hazan <ghazan@miranda.im>2018-07-17 12:48:47 +0300
commit2a67f794ee0f35bb0e9bbfd269eac15c12c6f976 (patch)
tree58a77235396684557419cb58ebab652f72b5eb89 /plugins/Dbx_mdbx
parent012c4cabbde8edc69a6309cb291246a26db1cf20 (diff)
added error logger for libmdbx
Diffstat (limited to 'plugins/Dbx_mdbx')
-rw-r--r--plugins/Dbx_mdbx/src/init.cpp10
1 files changed, 10 insertions, 0 deletions
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;
}