/* -------------------------------------------------------------------------- **
* Produce a version of the given buffer without any trailing newlines.
*/
+#if defined(HAVE_LIBSYSTEMD_JOURNAL) || defined(HAVE_LIBSYSTEMD) || \
+ defined(HAVE_LTTNG_TRACEF) || defined(HAVE_GPFS)
static void copy_no_nl(char *out,
size_t out_size,
const char *in,
out[len] = '\0';
}
-#if defined(HAVE_LIBSYSTEMD_JOURNAL) || defined(HAVE_LIBSYSTEMD) || \
- defined(HAVE_LTTNG_TRACEF) || defined(HAVE_GPFS)
static void ensure_copy_no_nl(char *out,
size_t out_size,
const char *in,
msg_level,
NULL);
}
+ ensure_copy_no_nl(state.msg_no_nl,
+ sizeof(state.msg_no_nl),
+ msg, msg_len);
sd_journal_send("MESSAGE=%s", state.msg_no_nl,
"PRIORITY=%d", debug_level_to_priority(msg_level),
"LEVEL=%d", msg_level,
state.hs_len);
tracef(state.header_str_no_nl);
}
+ ensure_copy_no_nl(state.msg_no_nl,
+ sizeof(state.msg_no_nl),
+ msg, msg_len);
tracef(state.msg_no_nl);
}
#endif /* WITH_LTTNG_TRACEF */
state.hs_len);
gpfswrap_add_trace(msg_level, state.header_str_no_nl);
}
+ ensure_copy_no_nl(state.msg_no_nl,
+ sizeof(state.msg_no_nl),
+ msg, msg_len);
gpfswrap_add_trace(msg_level, state.msg_no_nl);
}
#endif /* HAVE_GPFS */
size_t i;
/*
- * Some backends already add an extra newline, so also provide
- * a buffer without the newline character.
+ * Some backends already add an extra newline, so initialize a
+ * buffer without the newline character. It will be filled by
+ * the first backend that needs it.
*/
- copy_no_nl(state.msg_no_nl, FORMAT_BUFR_SIZE, msg, msg_len);
+ state.msg_no_nl[0] = '\0';
for (i = 0; i < ARRAY_SIZE(debug_backends); i++) {
if (msg_level <= debug_backends[i].log_level) {