Created
March 9, 2021 18:44
-
-
Save mill1000/8ae57b9c6ecc499f1f999f03191862f7 to your computer and use it in GitHub Desktop.
Simple ESP32 log wrapper that adds function name and line number to output
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifndef __LOG__ | |
#define __LOG__ | |
#include "esp_log.h" | |
#define __FORMAT(FORMAT) "(%s:%d) " FORMAT | |
#define LOGD(TAG, FORMAT, ...) ESP_LOGD(TAG, __FORMAT(FORMAT), __func__, __LINE__, ##__VA_ARGS__) | |
#define LOGI(TAG, FORMAT, ...) ESP_LOGI(TAG, __FORMAT(FORMAT), __func__, __LINE__, ##__VA_ARGS__) | |
#define LOGW(TAG, FORMAT, ...) ESP_LOGW(TAG, __FORMAT(FORMAT), __func__, __LINE__, ##__VA_ARGS__) | |
#define LOGE(TAG, FORMAT, ...) ESP_LOGE(TAG, __FORMAT(FORMAT), __func__, __LINE__, ##__VA_ARGS__) | |
#endif |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment