[neon/backports-focal/xdg-desktop-portal/Neon/unstable] src: xdp: Send messages to stderr, not stdout

Simon McVittie null at kde.org
Wed Jan 13 06:32:43 GMT 2021


Git commit 5b0b39ede92f3025205ab7562fb4ab274fd0b839 by Simon McVittie.
Committed on 09/09/2020 at 12:01.
Pushed by ash into branch 'Neon/unstable'.

xdp: Send messages to stderr, not stdout

This is done for two reasons:

1. Logging on stdout can interfere with machine-readable protocols.

2. stdout is normally fully buffered, whereas stderr is normally
   line-buffered. It's a lot easier to debug the service when messages
   don't lag behind.

Signed-off-by: Simon McVittie <smcv at collabora.com>

M  +2    -2    src/xdg-desktop-portal.c

https://invent.kde.org/neon/backports-focal/xdg-desktop-portal/commit/5b0b39ede92f3025205ab7562fb4ab274fd0b839

diff --git a/src/xdg-desktop-portal.c b/src/xdg-desktop-portal.c
index f049d19..88a6c5e 100644
--- a/src/xdg-desktop-portal.c
+++ b/src/xdg-desktop-portal.c
@@ -79,9 +79,9 @@ message_handler (const gchar *log_domain,
 {
   /* Make this look like normal console output */
   if (log_level & G_LOG_LEVEL_DEBUG)
-    printf ("XDP: %s\n", message);
+    fprintf (stderr, "XDP: %s\n", message);
   else
-    printf ("%s: %s\n", g_get_prgname (), message);
+    fprintf (stderr, "%s: %s\n", g_get_prgname (), message);
 }
 
 static void



More information about the Neon-commits mailing list