add session id generator

This commit is contained in:
luwenpeng
2024-01-31 14:45:50 +08:00
parent 2766b3cfeb
commit 97ef872d9a
21 changed files with 385 additions and 167 deletions

View File

@@ -6,6 +6,7 @@
#include <stdarg.h>
#include <time.h>
#include <stdlib.h>
#include <pthread.h>
#include "log.h"
#include "toml.h"
@@ -276,6 +277,8 @@ void log_print(enum log_level level, const char *module, const char *fmt, ...)
// add time
p += snprintf(p, end - p, "%s %s %d %02d:%02d:%02d %d ",
weekday_str[local.tm_wday], month_str[local.tm_mon], local.tm_mday, local.tm_hour, local.tm_min, local.tm_sec, local.tm_year + 1900);
// add tid
p += snprintf(p, end - p, "%lu ", pthread_self());
// add level
p += snprintf(p, end - p, "%s ", level_str[level]);
// add module