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 52DF65A0306 for ; Wed, 29 May 2024 11:04:17 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gibson.dropbear.id.au; s=202312; t=1716973448; bh=EuiFZF/1MnBTFU5ZnHKm1HpriAbm15wc/FrOPDeOHOY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=haQKMKaYAPpJ0giRdOuuQIS2kU98cal3QTkEH9K9Y8FFk1SQGf89n9LPRZwJRxso5 XaFKHFToiDQWyCg4Td0eXGIpc5/afwOXJ/yXTKE+5NnMgyeaV8rQdBvtJwNgxbGoPR IDWuqCq9A3Qo3DuSAkkilxi5aJfimbxcw3tlPwf/2fWeUEtFmEosdnJVrExBZvBvCC aSRMTSPOc3l+A77slz4riswxblgSDoPfnUS3a9Jtm3Vtkjl8iI7Nk+lYlO96LED3oB 6+RkZ019yliD2txBijzTehe7dlXSoTL0M4+zPg8Htor4FF6RpnATmItarCpZCcJVFg yhYQqRYaNcCMA== Received: by gandalf.ozlabs.org (Postfix, from userid 1007) id 4Vq3N84hRkz4x11; Wed, 29 May 2024 19:04:08 +1000 (AEST) From: David Gibson To: passt-dev@passt.top, Stefano Brivio Subject: [PATCH 3/3] log: Remove log_to_stdout option Date: Wed, 29 May 2024 19:04:05 +1000 Message-ID: <20240529090405.965748-4-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.45.1 In-Reply-To: <20240529090405.965748-1-david@gibson.dropbear.id.au> References: <20240529090405.965748-1-david@gibson.dropbear.id.au> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Message-ID-Hash: Z6CUIDK64PYGFOCBIX3ADIA6V7D6DYQV X-Message-ID-Hash: Z6CUIDK64PYGFOCBIX3ADIA6V7D6DYQV 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