summaryrefslogtreecommitdiff
path: root/plugins/Dbx_sqlite/src/utils.cpp
blob: 5c3202fef578fc2387c7953b3bb9d22a0084647b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#include "stdafx.h"
#include <time.h>

static HANDLE hLogger;

void logError(int rc, const char *szFile, int line)
{
	switch (rc) {
	case SQLITE_OK:
	case SQLITE_ROW:
	case SQLITE_DONE:
		return;
	}

	if (hLogger == nullptr) {
		wchar_t wszFileName[MAX_PATH];
		wsprintf(wszFileName, L"C:\\Users\\user\\Desktop\\sqlite.%d.log", (int)time(0));
		hLogger = mir_createLog("mdbx", L"mdbx", wszFileName, 0);
	}

	mir_writeLogA(hLogger, "sqlite: assertion failed (%s, %d): %d\n", szFile, line, rc);
}