[polari/wip/fmuellner/logging: 4/4] main: Turn on all messages when logging to journal



commit 91cbc26c4345e555b3a1335e838907f9edaeea23
Author: Florian Müllner <fmuellner gnome org>
Date:   Sat Sep 10 01:12:37 2016 +0200

    main: Turn on all messages when logging to journal
    
    Unless turned on with the G_MESSAGES_DEBUG env variable, the default
    log functions drop debug and info messages. While this behavior is
    reasonable when writing to the console, the journal's log viewer
    already filters messages by priority by default, so it makes more
    sense to log everything in that case, as we won't have to ask people
    to reproduce issues with debugging turned on.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=771218

 src/main.js |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
---
diff --git a/src/main.js b/src/main.js
index 4075f64..99d0adf 100755
--- a/src/main.js
+++ b/src/main.js
@@ -36,6 +36,10 @@ window.critical = _makeLogFunction(GLib.LogLevelFlags.LEVEL_CRITICAL);
 window.error    = _makeLogFunction(GLib.LogLevelFlags.LEVEL_ERROR);
 
 function main(args) {
+    // Log all messages when connected to the journal
+    if (GLib.log_writer_is_journald(2))
+        GLib.setenv('G_MESSAGES_DEBUG', LOG_DOMAIN, false);
+
     let application = new Application.Application();
     if (GLib.getenv('POLARI_PERSIST'))
         application.hold();


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]