From: Vladimír Čunát Date: Tue, 10 Dec 2019 17:04:15 +0000 (+0100) Subject: daemon/ tty commands: don't log unless --verbose X-Git-Tag: v5.0.0~23^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fe00c2a440a60369ebc036949fd64c2eb656d303;p=thirdparty%2Fknot-resolver.git daemon/ tty commands: don't log unless --verbose It's minimalistic: no change if in interactive or --verbose mode. --- diff --git a/NEWS b/NEWS index 149d1a922..b84f354d3 100644 --- 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) ================================ diff --git a/daemon/main.c b/daemon/main.c index 3a8185502..e020391d2 100644 --- a/daemon/main.c +++ b/daemon/main.c @@ -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: