mirror of
https://github.com/oopuuu/zTC1.git
synced 2025-12-12 21:18:13 +08:00
优化 web_log
This commit is contained in:
@@ -21,12 +21,12 @@ extern char time_buf[];
|
||||
void SetLogRecord(LogRecord* lr, char* log);
|
||||
char* GetLogRecord();
|
||||
|
||||
#define web_log(format, ...) \
|
||||
#define web_log(N, M, ...) \
|
||||
LOG_TMP = (char*)malloc(sizeof(char)*LOG_LEN); \
|
||||
now = time(NULL); \
|
||||
now += 28800; \
|
||||
strftime(time_buf, TIM_LEN, "[%Y-%m-%d %H:%M:%S]", localtime(&now)); \
|
||||
snprintf(LOG_TMP, LOG_LEN, "%s"format, time_buf, ##__VA_ARGS__); \
|
||||
strftime(time_buf, TIM_LEN, "%Y-%m-%d %H:%M:%S", localtime(&now)); \
|
||||
snprintf(LOG_TMP, LOG_LEN, "[%s][%s %s:%d] "M, time_buf, N, SHORT_FILE, __LINE__, ##__VA_ARGS__); \
|
||||
SetLogRecord(&log_record, LOG_TMP); \
|
||||
|
||||
#endif // !WEB_LOG_H
|
||||
|
||||
16
TC1/main.h
16
TC1/main.h
@@ -4,14 +4,14 @@
|
||||
#include "mico.h"
|
||||
#include "micokit_ext.h"
|
||||
|
||||
#define app_log(M, ...) do { custom_log("APP", M, ##__VA_ARGS__); web_log(M, ##__VA_ARGS__) } while(0)
|
||||
#define key_log(M, ...) do { custom_log("KEY", M, ##__VA_ARGS__); web_log(M, ##__VA_ARGS__) } while(0)
|
||||
#define ota_log(M, ...) do { custom_log("OTA", M, ##__VA_ARGS__); web_log(M, ##__VA_ARGS__) } while(0)
|
||||
#define rtc_log(M, ...) do { custom_log("RTC", M, ##__VA_ARGS__); web_log(M, ##__VA_ARGS__) } while(0)
|
||||
#define tc1_log(M, ...) do { custom_log("TC1", M, ##__VA_ARGS__); web_log(M, ##__VA_ARGS__) } while(0)
|
||||
#define http_log(M, ...) do { custom_log("HTTP", M, ##__VA_ARGS__); web_log(M, ##__VA_ARGS__) } while(0)
|
||||
#define mqtt_log(M, ...) do { custom_log("MQTT", M, ##__VA_ARGS__); web_log(M, ##__VA_ARGS__) } while(0)
|
||||
#define wifi_log(M, ...) do { custom_log("WIFI", M, ##__VA_ARGS__); web_log(M, ##__VA_ARGS__) } while(0)
|
||||
#define app_log(M, ...) do { custom_log("APP", M, ##__VA_ARGS__); web_log("APP", M, ##__VA_ARGS__) } while(0)
|
||||
#define key_log(M, ...) do { custom_log("KEY", M, ##__VA_ARGS__); web_log("KEY", M, ##__VA_ARGS__) } while(0)
|
||||
#define ota_log(M, ...) do { custom_log("OTA", M, ##__VA_ARGS__); web_log("OTA", M, ##__VA_ARGS__) } while(0)
|
||||
#define rtc_log(M, ...) do { custom_log("RTC", M, ##__VA_ARGS__); web_log("RTC", M, ##__VA_ARGS__) } while(0)
|
||||
#define tc1_log(M, ...) do { custom_log("TC1", M, ##__VA_ARGS__); web_log("TC1", M, ##__VA_ARGS__) } while(0)
|
||||
#define http_log(M, ...) do { custom_log("HTTP", M, ##__VA_ARGS__); web_log("HTTP", M, ##__VA_ARGS__) } while(0)
|
||||
#define mqtt_log(M, ...) do { custom_log("MQTT", M, ##__VA_ARGS__); web_log("MQTT", M, ##__VA_ARGS__) } while(0)
|
||||
#define wifi_log(M, ...) do { custom_log("WIFI", M, ##__VA_ARGS__); web_log("WIFI", M, ##__VA_ARGS__) } while(0)
|
||||
|
||||
#define VERSION "v1.0.15"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user