aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/main.c25
1 files changed, 24 insertions, 1 deletions
diff --git a/src/main.c b/src/main.c
index 9b7a6b8c..d99183a9 100644
--- a/src/main.c
+++ b/src/main.c
@@ -111,13 +111,36 @@ pp_define(const char *symbol)
/* Logging & debugging */
+static mu_stream_t mf_trace_stream;
+
+static void
+open_trace_stream()
+{
+ int rc = mu_filter_create(&mf_trace_stream,
+ mf_strecho,
+ "C-escape",
+ MU_FILTER_ENCODE,
+ MU_STREAM_WRITE);
+ if (rc) {
+ mu_error(_("cannot create trace stream, "
+ "using standard log: %s"),
+ mu_strerror(rc));
+ mf_trace_stream = mf_strecho;
+ }
+}
+
void
trace(const char *fmt, ...)
{
if (do_trace) {
va_list ap;
+
+ if (!mf_trace_stream)
+ open_trace_stream();
+
va_start(ap, fmt);
- vlogmsg(MU_LOG_INFO, fmt, ap);
+ mu_stream_vprintf(mf_trace_stream, fmt, ap);
+ mu_stream_flush(mf_trace_stream);
va_end(ap);
}
}

Return to:

Send suggestions and report system problems to the System administrator.