Commit d40e4016 authored by Guido Gunther's avatar Guido Gunther Committed by Guido Gunther
Browse files

main: Toggle debug messages on SIGUSR1



We need to use a custom log handler to stay clear
of modifying the env var.
Signed-off-by: Guido Gunther's avatarGuido Günther <guido.gunther@puri.sm>
parent c39e4b61
Pipeline #59667 passed with stages
in 64 minutes and 30 seconds
......@@ -10,6 +10,7 @@
#include "config.h"
#include "log.h"
#include "shell.h"
#include "phosh-wayland.h"
......@@ -29,6 +30,28 @@ quit (gpointer unused)
}
static gboolean
on_sigusr1_signal (gpointer unused)
{
static gboolean logall = FALSE;
if (logall) {
const char *domains;
domains = g_getenv ("G_MESSAGES_DEBUG");
g_message ("Enabling messages for %s", domains);
phosh_log_set_log_domains (domains);
logall = FALSE;
} else {
g_message ("Enabling all log messages");
phosh_log_set_log_domains ("all");
logall = TRUE;
}
return G_SOURCE_CONTINUE;
}
static gboolean
on_shutdown_signal (gpointer unused)
{
......@@ -79,6 +102,8 @@ int main(int argc, char *argv[])
print_version ();
}
phosh_log_set_log_domains (g_getenv("G_MESSAGES_DEBUG"));
textdomain (GETTEXT_PACKAGE);
bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR);
......@@ -87,6 +112,7 @@ int main(int argc, char *argv[])
g_unix_signal_add (SIGTERM, on_shutdown_signal, NULL);
g_unix_signal_add (SIGINT, on_shutdown_signal, NULL);
g_unix_signal_add (SIGUSR1, on_sigusr1_signal, NULL);
wl = phosh_wayland_get_default ();
shell = phosh_shell_get_default ();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment