public inbox for passt-dev@passt.top
 help / color / mirror / code / Atom feed
From: David Gibson <david@gibson.dropbear.id.au>
To: Stefano Brivio <sbrivio@redhat.com>, passt-dev@passt.top
Cc: erik.sjolund@gmail.com, David Gibson <david@gibson.dropbear.id.au>
Subject: [PATCH v2 3/3] log: Remove log_to_stdout option
Date: Wed,  5 Jun 2024 10:42:42 +1000	[thread overview]
Message-ID: <20240605004243.3330116-4-david@gibson.dropbear.id.au> (raw)
In-Reply-To: <20240605004243.3330116-1-david@gibson.dropbear.id.au>

Now that we've simplified how usage() works, nothing ever sets the
log_to_stdout flag. Eliminate it.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
---
 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 {								\
-- 
@@ -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


  parent reply	other threads:[~2024-06-05  0:42 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-05  0:42 [PATCH v2 0/3] conf, log: Fix regression in usage() printing David Gibson
2024-06-05  0:42 ` [PATCH v2 1/3] conf: Remove unhelpful usage() wrapper David Gibson
2024-06-05  0:42 ` [PATCH v2 2/3] conf: Don't print usage via the logging subsystem David Gibson
2024-06-05  0:42 ` David Gibson [this message]
2024-06-05 19:59 ` [PATCH v2 0/3] conf, log: Fix regression in usage() printing Stefano Brivio

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240605004243.3330116-4-david@gibson.dropbear.id.au \
    --to=david@gibson.dropbear.id.au \
    --cc=erik.sjolund@gmail.com \
    --cc=passt-dev@passt.top \
    --cc=sbrivio@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://passt.top/passt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for IMAP folder(s).