feedbackd: Add --verbose option

Easier to discover than `G_MESSAGES_DEBUG`

Signed-off-by: Guido Günther <agx@sigxcpu.org>
This commit is contained in:
Guido Günther
2026-01-16 16:38:29 +01:00
parent 8d0c09522d
commit 94b35f356a
2 changed files with 18 additions and 2 deletions
+3
View File
@@ -38,6 +38,9 @@ Options
``-h``, ``--help`` ``-h``, ``--help``
print help and exit print help and exit
``-v``, ``--verbose``
print verbose information
Configuration Configuration
============= =============
+15 -2
View File
@@ -1,6 +1,9 @@
/* /*
* Copyright (C) 2020 Purism SPC * Copyright (C) 2020 Purism SPC
* 2023-2026 Phosh.mobi e.V.
*
* SPDX-License-Identifier: GPL-3.0+ * SPDX-License-Identifier: GPL-3.0+
*
* Author: Guido Günther <agx@sigxcpu.org> * Author: Guido Günther <agx@sigxcpu.org>
*/ */
@@ -112,18 +115,28 @@ name_lost_cb (GDBusConnection *connection,
int int
main (int argc, char *argv[]) main (int argc, char *argv[])
{ {
g_autoptr(GError) err = NULL; g_autoptr (GError) err = NULL;
g_autoptr(GOptionContext) opt_context = NULL; gboolean opt_verbose = FALSE;
g_autoptr (GOptionContext) opt_context = NULL;
g_autoptr (FbdFeedbackManager) manager = NULL; g_autoptr (FbdFeedbackManager) manager = NULL;
const char *debugenv; const char *debugenv;
GOptionEntry options[] = {
{ "verbose", 'v', 0, G_OPTION_ARG_NONE, &opt_verbose,
"Print debug information during command processing", NULL },
{ NULL }
};
opt_context = g_option_context_new ("- A daemon to trigger event feedback"); opt_context = g_option_context_new ("- A daemon to trigger event feedback");
g_option_context_add_main_entries (opt_context, options, NULL);
if (!g_option_context_parse (opt_context, &argc, &argv, &err)) { if (!g_option_context_parse (opt_context, &argc, &argv, &err)) {
g_warning ("%s", err->message); g_warning ("%s", err->message);
g_clear_error (&err); g_clear_error (&err);
return 1; return 1;
} }
if (opt_verbose)
g_log_writer_default_set_debug_domains ((const char *const[]){ "all", NULL });
debugenv = g_getenv ("FEEDBACKD_DEBUG"); debugenv = g_getenv ("FEEDBACKD_DEBUG");
fbd_debug_flags = g_parse_debug_string (debugenv, fbd_debug_flags = g_parse_debug_string (debugenv,
debug_keys, debug_keys,