From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail.ozlabs.org (mail.ozlabs.org [IPv6:2404:9400:2221:ea00::3]) by passt.top (Postfix) with ESMTPS id C716E5A0307 for ; Wed, 05 Jun 2024 02:42:47 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gibson.dropbear.id.au; s=202312; t=1717548165; bh=EuiFZF/1MnBTFU5ZnHKm1HpriAbm15wc/FrOPDeOHOY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=r/35mqY1/A8dxQ2DKXaSncNaN9HORFcZNJRExZXq/oCGdYZaoIoCxLeI2IFAWuwvN nxGqxLrTXjqcJbH6WPn9x0NS0FxR5xP1pLT9ajszamHpGNARP1a6WKQxWd3mHWyltI eFkoPBlNjATN3jckEEacr//bli4TUkobYWQZAUOb2sP8mySUPlvVIC4yOlsD31SHGd WRr4zE9si00qyA7pf2BojsMJkXMjj4/TCIZVIcWAQpYPZHB1W+pol4lJnkK/JTPIPK 2FegkQf2PP5OT3FLDh04RIKtGHYuZR1tCU0Y9ykb6PVIUH4JJl8K5Smc8fJAPzdrtv 2odKwOZ7Nt8yQ== Received: by gandalf.ozlabs.org (Postfix, from userid 1007) id 4Vv7wP01N6z4wc4; Wed, 5 Jun 2024 10:42:44 +1000 (AEST) From: David Gibson To: Stefano Brivio , passt-dev@passt.top Subject: [PATCH v2 3/3] log: Remove log_to_stdout option Date: Wed, 5 Jun 2024 10:42:42 +1000 Message-ID: <20240605004243.3330116-4-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.45.1 In-Reply-To: <20240605004243.3330116-1-david@gibson.dropbear.id.au> References: <20240605004243.3330116-1-david@gibson.dropbear.id.au> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Message-ID-Hash: XY6UUHMWWXXP7XNBCNZTTUMWFD5DDXSF X-Message-ID-Hash: XY6UUHMWWXXP7XNBCNZTTUMWFD5DDXSF X-MailFrom: dgibson@gandalf.ozlabs.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: erik.sjolund@gmail.com, David Gibson X-Mailman-Version: 3.3.8 Precedence: list List-Id: Development discussion and patches for passt Archived-At: Archived-At: List-Archive: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Now that we've simplified how usage() works, nothing ever sets the log_to_stdout flag. Eliminate it. Signed-off-by: David Gibson --- log.c | 8 +++----- log.h | 1 - 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/log.c b/log.c index e3630c35..aaf2beb5 100644 --- a/log.c +++ b/log.c @@ -46,18 +46,16 @@ static char log_header[BUFSIZ]; /* File header, written back on cuts */ static time_t log_start; /* Start timestamp */ int log_trace; /* --trace mode enabled */ -int log_to_stdout; /* Print to stdout instead of stderr */ void vlogmsg(int pri, const char *format, va_list ap) { bool debug_print = (log_mask & LOG_MASK(LOG_DEBUG)) && log_file == -1; bool early_print = LOG_PRI(log_mask) == LOG_EARLY; - FILE *out = log_to_stdout ? stdout : stderr; struct timespec tp; if (debug_print) { clock_gettime(CLOCK_REALTIME, &tp); - fprintf(out, "%lli.%04lli: ", + fprintf(stderr, "%lli.%04lli: ", (long long int)tp.tv_sec - log_start, (long long int)tp.tv_nsec / (100L * 1000)); } @@ -75,9 +73,9 @@ void vlogmsg(int pri, const char *format, va_list ap) } if (debug_print || (early_print && !(log_opt & LOG_PERROR))) { - (void)vfprintf(out, format, ap); + (void)vfprintf(stderr, format, ap); if (format[strlen(format)] != '\n') - fprintf(out, "\n"); + fprintf(stderr, "\n"); } } diff --git a/log.h b/log.h index 9c38182f..e0aab5a9 100644 --- a/log.h +++ b/log.h @@ -28,7 +28,6 @@ void logmsg(int pri, const char *format, ...) } while (0) extern int log_trace; -extern int log_to_stdout; void trace_init(int enable); #define trace(...) \ do { \ -- 2.45.1