1
0
mirror of https://github.com/armink/EasyLogger.git synced 2025-01-19 07:42:52 +08:00

更改函数名称及行号得打印顺序(便于vscode直接跳转)

This commit is contained in:
guoqi 2021-07-28 17:18:58 +08:00
parent 9bacff022c
commit c8ee635861

View File

@ -632,26 +632,27 @@ void elog_output(uint8_t level, const char *tag, const char *file, const char *f
/* package file directory and name, function name and line number info */
if (get_fmt_enabled(level, ELOG_FMT_DIR | ELOG_FMT_FUNC | ELOG_FMT_LINE)) {
log_len += elog_strcpy(log_len, log_buf + log_len, "(");
/* package time info */
/* package file info */
if (get_fmt_enabled(level, ELOG_FMT_DIR)) {
log_len += elog_strcpy(log_len, log_buf + log_len, file);
if (get_fmt_enabled(level, ELOG_FMT_FUNC)) {
log_len += elog_strcpy(log_len, log_buf + log_len, " ");
log_len += elog_strcpy(log_len, log_buf + log_len, ":");
} else if (get_fmt_enabled(level, ELOG_FMT_LINE)) {
log_len += elog_strcpy(log_len, log_buf + log_len, ":");
log_len += elog_strcpy(log_len, log_buf + log_len, " ");
}
}
/* package process info */
if (get_fmt_enabled(level, ELOG_FMT_FUNC)) {
log_len += elog_strcpy(log_len, log_buf + log_len, func);
if (get_fmt_enabled(level, ELOG_FMT_LINE)) {
log_len += elog_strcpy(log_len, log_buf + log_len, ":");
}
}
/* package thread info */
/* package line info */
if (get_fmt_enabled(level, ELOG_FMT_LINE)) {
snprintf(line_num, ELOG_LINE_NUM_MAX_LEN, "%ld", line);
log_len += elog_strcpy(log_len, log_buf + log_len, line_num);
if (get_fmt_enabled(level, ELOG_FMT_FUNC)) {
log_len += elog_strcpy(log_len, log_buf + log_len, " ");
}
}
/* package func info */
if (get_fmt_enabled(level, ELOG_FMT_FUNC)) {
log_len += elog_strcpy(log_len, log_buf + log_len, func);
}
log_len += elog_strcpy(log_len, log_buf + log_len, ")");
}