summaryrefslogtreecommitdiff
path: root/src/qcam/message_handler.h
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>2020-11-24 18:55:55 +0200
committerLaurent Pinchart <laurent.pinchart@ideasonboard.com>2020-12-01 15:16:17 +0200
commit02b129dab5c7dc8817b397f01d15fdd553e2aea6 (patch)
treecfb723e809ad95de02148e2658916c625569aa2c /src/qcam/message_handler.h
parented895fd0d53c8ee174e2c662f69b1e376621ca7f (diff)
qcam: Make log less verbose by default
The qcam log prints one message per frame, which is pretty verbose. This feature is useful for debugging, but not necessarily as a default option. Silence it by default, and add a -v/--verbose command line parameter to make the log verbose. While this could have been handled manually by checking a verbose flag when printing the message, the feature is instead integrated with the Qt log infrastructure to make it more flexible. Messages printed by qDebug() are now silenced by default and controlled by the -v/--verbose argument. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Diffstat (limited to 'src/qcam/message_handler.h')
-rw-r--r--src/qcam/message_handler.h26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/qcam/message_handler.h b/src/qcam/message_handler.h
new file mode 100644
index 00000000..4534db9d
--- /dev/null
+++ b/src/qcam/message_handler.h
@@ -0,0 +1,26 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
+/*
+ * Copyright (C) 2020, Laurent Pinchart <laurent.pinchart@ideasonboard.com>
+ *
+ * message_handler.cpp - qcam - Log message handling
+ */
+#ifndef __QCAM_MESSAGE_HANDLER_H__
+#define __QCAM_MESSAGE_HANDLER_H__
+
+#include <QtGlobal>
+
+class MessageHandler
+{
+public:
+ MessageHandler(bool verbose);
+
+private:
+ static void handleMessage(QtMsgType type,
+ const QMessageLogContext &context,
+ const QString &msg);
+
+ static QtMessageHandler handler_;
+ static bool verbose_;
+};
+
+#endif /* __QCAM_MESSAGE_HANDLER_H__ */