diff --git a/TC1/http_server/web_log.c b/TC1/http_server/web_log.c index bbf85e1..f8f2569 100644 --- a/TC1/http_server/web_log.c +++ b/TC1/http_server/web_log.c @@ -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; //¶«8Çø 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); } diff --git a/TC1/http_server/web_log.h b/TC1/http_server/web_log.h index 605183c..b96b4fc 100644 --- a/TC1/http_server/web_log.h +++ b/TC1/http_server/web_log.h @@ -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