Skip to content

Commit 30a75cd

Browse files
committed
up
1 parent 6ceb6f2 commit 30a75cd

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

TC1/http_server/web_log.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,18 +40,17 @@ char* GetLogRecord()
4040
return log_record_str;
4141
}
4242

43-
void web_log(const char *N, const char *M, ...)
43+
void WebLog(const char *M, ...)
4444
{
4545
va_list ap;
4646
va_start(ap, M);
4747
int ret = vsnprintf(log, sizeof(log), M, ap);
4848
va_end(ap);
4949

5050
LOG_TMP = (char*)malloc(sizeof(char)*LOG_LEN);
51-
now = time(NULL);
52-
now += 28800;
51+
now = time(NULL) + 28800; //¶«8Çø
5352
strftime(time_buf, TIM_LEN, "%Y-%m-%d %H:%M:%S", localtime(&now));
54-
snprintf(LOG_TMP, LOG_LEN, "[%s][%s %s:%d] %s", time_buf, N, SHORT_FILE, __LINE__, log);
53+
snprintf(LOG_TMP, LOG_LEN, "[%s]%s", time_buf, log);
5554
SetLogRecord(&log_record, LOG_TMP);
5655
}
5756

TC1/http_server/web_log.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ extern char time_buf[];
2020

2121
void SetLogRecord(LogRecord* lr, char* log);
2222
char* GetLogRecord();
23-
void web_log(const char *N, const char *M, ...);
23+
void WebLog(const char *M, ...);
2424

2525
#define web_log0(N, M, ...) \
2626
LOG_TMP = (char*)malloc(sizeof(char)*LOG_LEN); \
@@ -30,4 +30,6 @@ void web_log(const char *N, const char *M, ...);
3030
snprintf(LOG_TMP, LOG_LEN, "[%s][%s %s:%d] "M, time_buf, N, SHORT_FILE, __LINE__, ##__VA_ARGS__); \
3131
SetLogRecord(&log_record, LOG_TMP); \
3232

33+
#define web_log(N, M, ...) WebLog("["N" %s:%d] "M, SHORT_FILE, __LINE__, ##__VA_ARGS__)
34+
3335
#endif // !WEB_LOG_H

0 commit comments

Comments
 (0)