This commit is contained in:
zogodo
2020-12-03 18:18:07 +08:00
parent 6ceb6f2401
commit 30a75cdc1b
2 changed files with 6 additions and 5 deletions

View File

@@ -40,7 +40,7 @@ char* GetLogRecord()
return log_record_str;
}
void web_log(const char *N, const char *M, ...)
void WebLog(const char *M, ...)
{
va_list ap;
va_start(ap, M);
@@ -48,10 +48,9 @@ void web_log(const char *N, const char *M, ...)
va_end(ap);
LOG_TMP = (char*)malloc(sizeof(char)*LOG_LEN);
now = time(NULL);
now += 28800;
now = time(NULL) + 28800; //<2F><>8<EFBFBD><38>
strftime(time_buf, TIM_LEN, "%Y-%m-%d %H:%M:%S", localtime(&now));
snprintf(LOG_TMP, LOG_LEN, "[%s][%s %s:%d] %s", time_buf, N, SHORT_FILE, __LINE__, log);
snprintf(LOG_TMP, LOG_LEN, "[%s]%s", time_buf, log);
SetLogRecord(&log_record, LOG_TMP);
}

View File

@@ -20,7 +20,7 @@ extern char time_buf[];
void SetLogRecord(LogRecord* lr, char* log);
char* GetLogRecord();
void web_log(const char *N, const char *M, ...);
void WebLog(const char *M, ...);
#define web_log0(N, M, ...) \
LOG_TMP = (char*)malloc(sizeof(char)*LOG_LEN); \
@@ -30,4 +30,6 @@ void web_log(const char *N, const char *M, ...);
snprintf(LOG_TMP, LOG_LEN, "[%s][%s %s:%d] "M, time_buf, N, SHORT_FILE, __LINE__, ##__VA_ARGS__); \
SetLogRecord(&log_record, LOG_TMP); \
#define web_log(N, M, ...) WebLog("["N" %s:%d] "M, SHORT_FILE, __LINE__, ##__VA_ARGS__)
#endif // !WEB_LOG_H