mirror of
https://github.com/ventoy/Ventoy.git
synced 2025-05-29 06:15:27 -04:00
1.0.36 release
This commit is contained in:
parent
7b08954e57
commit
cbbd57eee5
58 changed files with 136 additions and 1042 deletions
|
@ -80,6 +80,34 @@ void ventoy_syslog_newline(int level, const char *Fmt, ...)
|
|||
pthread_mutex_unlock(&g_log_mutex);
|
||||
}
|
||||
|
||||
void ventoy_syslog_printf(const char *Fmt, ...)
|
||||
{
|
||||
char log[512];
|
||||
va_list arg;
|
||||
time_t stamp;
|
||||
struct tm ttm;
|
||||
FILE *fp;
|
||||
|
||||
time(&stamp);
|
||||
localtime_r(&stamp, &ttm);
|
||||
|
||||
va_start(arg, Fmt);
|
||||
vsnprintf(log, 512, Fmt, arg);
|
||||
va_end(arg);
|
||||
|
||||
pthread_mutex_lock(&g_log_mutex);
|
||||
fp = fopen(VTOY_LOG_FILE, "a+");
|
||||
if (fp)
|
||||
{
|
||||
fprintf(fp, "[%04u/%02u/%02u %02u:%02u:%02u] %s",
|
||||
ttm.tm_year, ttm.tm_mon, ttm.tm_mday,
|
||||
ttm.tm_hour, ttm.tm_min, ttm.tm_sec,
|
||||
log);
|
||||
fclose(fp);
|
||||
}
|
||||
pthread_mutex_unlock(&g_log_mutex);
|
||||
}
|
||||
|
||||
void ventoy_syslog(int level, const char *Fmt, ...)
|
||||
{
|
||||
char log[512];
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue