kDB: Knowledge DataBase
Loading...
Searching...
No Matches
Logging.h
1#include <clog_qt>
2#include <cres_clog>
3
4#define KDB_REPOSITORY_REPORT_QUERY_ERROR_FORMATED_MSG(_MSG_, _RESULT_, ...) \
5 "in SQLQuery: {} with error {} in query {}", clog_qt::qformat(_MSG_ __VA_OPT__(, ) __VA_ARGS__), \
6 _RESULT_.error(), _RESULT_.query()
7
8#define KDB_REPOSITORY_REPORT_QUERY_ERROR(_MSG_, _RESULT_, ...) \
9 clog_error( \
10 KDB_REPOSITORY_REPORT_QUERY_ERROR_FORMATED_MSG(_MSG_, _RESULT_ __VA_OPT__(, ) __VA_ARGS__))
11
12#define KDB_REPOSITORY_REPORT_QUERY_ERROR_RETURN(_MSG_, _RESULT_, ...) \
13 return cres_log_failure( \
14 KDB_REPOSITORY_REPORT_QUERY_ERROR_FORMATED_MSG(_MSG_, _RESULT_ __VA_OPT__(, ) __VA_ARGS__));
15
16#define KDB_REPOSITORY_EXECUTE_QUERY(_MSG_, _QUERY_, ...) \
17 { \
18 auto result = _QUERY_.execute(); \
19 if(not result) \
20 { \
21 KDB_REPOSITORY_REPORT_QUERY_ERROR_RETURN(_MSG_, result __VA_OPT__(, ) __VA_ARGS__); \
22 } \
23 }