@@ -65,35 +65,38 @@ extern "C"
6565#define ARDUHAL_LOG_RESET_COLOR
6666#endif
6767
68+ const char * pathToFileName (const char * path );
69+ int log_printf (const char * fmt , ...);
70+
6871#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__
7073
7174#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__)
7376#else
7477#define log_v (format , ...)
7578#endif
7679
7780#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__)
7982#else
8083#define log_d (format , ...)
8184#endif
8285
8386#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__)
8588#else
8689#define log_i (format , ...)
8790#endif
8891
8992#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__)
9194#else
9295#define log_w (format , ...)
9396#endif
9497
9598#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__)
97100#else
98101#define log_e (format , ...)
99102#endif
0 commit comments