Skip to content

Commit a48e7ab

Browse files
committed
Feedback (temporary -- will squash into above)
Signed-off-by: Alec Holmes <[email protected]>
1 parent 8ff4ffb commit a48e7ab

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/flb_log.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -823,14 +823,19 @@ void flb_log_print(int type, const char *file, int line, const char *fmt, ...)
823823
config = w->config;
824824
if (config != NULL && config->log != NULL) {
825825
msg_type_str = flb_log_message_type_str(type);
826+
if (msg_type_str == NULL) {
827+
msg_type_str = "unknown";
828+
}
829+
826830
ts = cfl_time_now();
827831
ret = cmt_counter_inc(config->log->metrics->logs_total_counter,
828832
ts,
829833
1, (char *[]) {msg_type_str});
830834
if (ret == -1) {
835+
// Not using flb_log_debug to avoid recursing into this same function.
831836
fprintf(stderr,
832837
"[log] failed to increment log total counter for message type '%s' (error=%d)\n",
833-
msg_type_str != NULL ? msg_type_str : "unknown", ret);
838+
msg_type_str, ret);
834839
}
835840
}
836841

0 commit comments

Comments
 (0)