aboutsummaryrefslogtreecommitdiffstats
path: root/common/logging.c
diff options
context:
space:
mode:
Diffstat (limited to 'common/logging.c')
-rw-r--r--common/logging.c37
1 files changed, 11 insertions, 26 deletions
diff --git a/common/logging.c b/common/logging.c
index 3b767cb97..6bc35eee5 100644
--- a/common/logging.c
+++ b/common/logging.c
@@ -283,32 +283,7 @@ set_file_fd (const char *name, int fd)
/* On error default to a stderr based estream. */
if (!fp)
- {
- fp = es_fpopen (stderr, "a");
- if (fp)
- {
- if (name)
- es_fprintf (fp, "failed to open log file `%s': %s\n",
- name, strerror (errno));
- else
- es_fprintf (fp, "failed to fdopen file descriptor %d: %s\n",
- fd, strerror (errno));
- }
- else
- {
- fprintf (stderr, "failed to use stderr as log stream: %s\n",
- strerror (errno));
- /* No way to log something. Create a dummy estream so that
- there is something we can use. */
- fp = es_fpopen (NULL, "a");
- if (!fp)
- {
- fprintf (stderr, "fatal: failed to open dummy stream: %s\n",
- strerror (errno));
- abort();
- }
- }
- }
+ fp = es_stderr;
es_setvbuf (fp, NULL, _IOLBF, 0);
@@ -605,6 +580,16 @@ log_printf (const char *fmt, ...)
}
+/* Flush the log - this is useful to make sure that the trailing
+ linefeed has been printed. */
+void
+log_flush (void)
+{
+ volatile va_list dummy_arg_ptr;
+ do_logv (JNLIB_LOG_CONT, 1, NULL, dummy_arg_ptr);
+}
+
+
/* Print a hexdump of BUFFER. With TEXT of NULL print just the raw
dump, with TEXT just an empty string, print a trailing linefeed,
otherwise print an entire debug line. */