@@ -65,35 +65,38 @@ extern "C"
65
65
#define ARDUHAL_LOG_RESET_COLOR
66
66
#endif
67
67
68
+ const char * pathToFileName (const char * path );
69
+ int log_printf (const char * fmt , ...);
70
+
68
71
#define ARDUHAL_SHORT_LOG_FORMAT (letter , format ) ARDUHAL_LOG_COLOR_ ## letter format ARDUHAL_LOG_RESET_COLOR "\r\n"
69
- #define ARDUHAL_LOG_FORMAT (letter , format ) ARDUHAL_LOG_COLOR_ ## letter "[" #letter "][%s():%d] " format ARDUHAL_LOG_RESET_COLOR "\r\n", __FUNCTION__ , __LINE__
72
+ #define ARDUHAL_LOG_FORMAT (letter , format ) ARDUHAL_LOG_COLOR_ ## letter "[" #letter "][%s:%u] %s(): " format ARDUHAL_LOG_RESET_COLOR "\r\n", pathToFileName(__FILE__) , __LINE__, __FUNCTION__
70
73
71
74
#if CONFIG_ARDUHAL_LOG_DEFAULT_LEVEL >= ARDUHAL_LOG_LEVEL_VERBOSE
72
- #define log_v (format , ...) ets_printf(ARDUHAL_SHORT_LOG_FORMAT (V, format), ##__VA_ARGS__)
75
+ #define log_v (format , ...) log_printf(ARDUHAL_LOG_FORMAT (V, format), ##__VA_ARGS__)
73
76
#else
74
77
#define log_v (format , ...)
75
78
#endif
76
79
77
80
#if CONFIG_ARDUHAL_LOG_DEFAULT_LEVEL >= ARDUHAL_LOG_LEVEL_DEBUG
78
- #define log_d (format , ...) ets_printf(ARDUHAL_SHORT_LOG_FORMAT (D, format), ##__VA_ARGS__)
81
+ #define log_d (format , ...) log_printf(ARDUHAL_LOG_FORMAT (D, format), ##__VA_ARGS__)
79
82
#else
80
83
#define log_d (format , ...)
81
84
#endif
82
85
83
86
#if CONFIG_ARDUHAL_LOG_DEFAULT_LEVEL >= ARDUHAL_LOG_LEVEL_INFO
84
- #define log_i (format , ...) ets_printf(ARDUHAL_SHORT_LOG_FORMAT (I, format), ##__VA_ARGS__)
87
+ #define log_i (format , ...) log_printf(ARDUHAL_LOG_FORMAT (I, format), ##__VA_ARGS__)
85
88
#else
86
89
#define log_i (format , ...)
87
90
#endif
88
91
89
92
#if CONFIG_ARDUHAL_LOG_DEFAULT_LEVEL >= ARDUHAL_LOG_LEVEL_WARN
90
- #define log_w (format , ...) ets_printf (ARDUHAL_LOG_FORMAT(W, format), ##__VA_ARGS__)
93
+ #define log_w (format , ...) log_printf (ARDUHAL_LOG_FORMAT(W, format), ##__VA_ARGS__)
91
94
#else
92
95
#define log_w (format , ...)
93
96
#endif
94
97
95
98
#if CONFIG_ARDUHAL_LOG_DEFAULT_LEVEL >= ARDUHAL_LOG_LEVEL_ERROR
96
- #define log_e (format , ...) ets_printf (ARDUHAL_LOG_FORMAT(E, format), ##__VA_ARGS__)
99
+ #define log_e (format , ...) log_printf (ARDUHAL_LOG_FORMAT(E, format), ##__VA_ARGS__)
97
100
#else
98
101
#define log_e (format , ...)
99
102
#endif
0 commit comments