diff --git a/main/logger.c b/main/logger.c index 5562bf37eb..5a9455231d 100644 --- a/main/logger.c +++ b/main/logger.c @@ -1675,32 +1690,34 @@ static struct logmsg * __attribute__((format(printf, 7, 0))) format_log_message_ /* Automatically add a newline to format strings that don't have one */ if (!ast_ends_with(ast_str_buffer(buf), "\n")) { ast_str_append(&buf, 0, "\n"); } /* Create a new logging message */ if (!(logmsg = ast_calloc_with_stringfields(1, struct logmsg, res + 128))) { return NULL; } - /* Copy string over */ - ast_string_field_set(logmsg, message, ast_str_buffer(buf)); - /* Set type */ if (level == __LOG_VERBOSE) { logmsg->type = LOGMSG_VERBOSE; } else { logmsg->type = LOGMSG_NORMAL; } if (display_callids && callid) { logmsg->callid = callid; + ast_string_field_build(logmsg, message, "[C-%08x] %s", logmsg->callid, ast_str_buffer(buf)); + } + else { + /* Copy string over */ + ast_string_field_set(logmsg, message, ast_str_buffer(buf)); } /* Create our date/time */ ast_localtime(&now, &tm, NULL); ast_strftime(datestring, sizeof(datestring), dateformat, &tm); ast_string_field_set(logmsg, date, datestring); /* Copy over data */ logmsg->level = level; logmsg->sublevel = sublevel;