summaryrefslogtreecommitdiffhomepage
path: root/tracker-trackhat
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2021-11-04 19:02:36 +0100
committerStanislaw Halik <sthalik@misaki.pl>2022-03-29 00:04:48 +0200
commit56a4c6c404fb3f58d2027d39f3acdab1490fc839 (patch)
tree6b17af490ee751e0e58413ae5d16fe26e4107792 /tracker-trackhat
parent9681d6dd1b88dc04c5bca027a6c125a4276d19d5 (diff)
tracker/trackhat: use logging handler for the C library
It's in my gitlab fork on fixes2 branch.
Diffstat (limited to 'tracker-trackhat')
-rw-r--r--tracker-trackhat/camera.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/tracker-trackhat/camera.cpp b/tracker-trackhat/camera.cpp
index b662dcdf..35384b80 100644
--- a/tracker-trackhat/camera.cpp
+++ b/tracker-trackhat/camera.cpp
@@ -91,8 +91,21 @@ error:
return {false, {}};
}
+static void log_handler(const char* file, int line, const char* function, char level, const char* str, size_t len)
+{
+ if (level != 'E')
+ return;
+ char file_[128];
+ snprintf(file_, std::size(file_), "trackhat/%s", file);
+ auto logger = QMessageLogger(file_, line, function).debug();
+ logger << "tracker/trackhat:";
+ logger.noquote() << QLatin1String(str, (int)len);
+}
+
bool trackhat_camera::start(const pt_settings&)
{
+ trackHat_SetDebugHandler(log_handler);
+
if constexpr(debug_mode)
trackHat_EnableDebugMode();
else