]> git.ipfire.org Git - thirdparty/knot-resolver.git/commitdiff
daemon/ tty commands: don't log unless --verbose
authorVladimír Čunát <vladimir.cunat@nic.cz>
Tue, 10 Dec 2019 17:04:15 +0000 (18:04 +0100)
committerVladimír Čunát <vladimir.cunat@nic.cz>
Tue, 10 Dec 2019 17:05:41 +0000 (18:05 +0100)
It's minimalistic: no change if in interactive or --verbose mode.

NEWS
daemon/main.c

diff --git a/NEWS b/NEWS
index 149d1a92287c81673123aa2e8e030af8e6b5ab1f..b84f354d39dae8b36213c2a3e4ae62ad3e44181a 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,11 @@
+Knot Resolver 4.x.y (20yy-mm-dd)
+================================
+
+Improvements
+------------
+- logging: control-socket commands don't log unless --verbose (#528)
+
+
 Knot Resolver 4.3.0 (2019-12-04)
 ================================
 
index 3a81855023976d8dec47de123bd341c4bf1c8bcd..e020391d2564ae834de3cdaa4319c77f57275569 100644 (file)
@@ -151,20 +151,23 @@ static void tty_process_input(uv_stream_t *stream, ssize_t nread, const uv_buf_t
                /* Log to remote socket if connected */
                const char *delim = args->quiet ? "" : "> ";
                if (stream_fd != STDIN_FILENO) {
-                       fprintf(stdout, "%s\n", cmd); /* Duplicate command to logs */
+                       if (VERBOSE_STATUS)
+                               fprintf(stdout, "%s\n", cmd); /* Duplicate command to logs */
                        if (message)
                                fprintf(out, "%s", message); /* Duplicate output to sender */
                        if (message || !args->quiet)
                                fprintf(out, "\n");
                        fprintf(out, "%s", delim);
                }
-               /* Log to standard streams */
-               FILE *fp_out = ret ? stderr : stdout;
-               if (message)
-                       fprintf(fp_out, "%s", message);
-               if (message || !args->quiet)
-                       fprintf(fp_out, "\n");
-               fprintf(fp_out, "%s", delim);
+               if (stream_fd == STDIN_FILENO || VERBOSE_STATUS) {
+                       /* Log to standard streams */
+                       FILE *fp_out = ret ? stderr : stdout;
+                       if (message)
+                               fprintf(fp_out, "%s", message);
+                       if (message || !args->quiet)
+                               fprintf(fp_out, "\n");
+                       fprintf(fp_out, "%s", delim);
+               }
                lua_settop(L, 0);
        }
 finish: