-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
213 additions
and
112 deletions.
There are no files selected for viewing
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
#pragma once | ||
|
||
#ifndef __LOG_HELPER_H__ | ||
#define __LOG_HELPER_H__ | ||
|
||
#include <cstdint> | ||
#include <esp_log.h> | ||
|
||
namespace LogHelper { | ||
static inline void log(const char *tag, const esp_log_level_t log_level, std::string &message) { | ||
va_list args; | ||
switch (log_level) { | ||
case ESP_LOG_ERROR: | ||
ESP_LOGE(tag, "%s", message.c_str()); | ||
break; | ||
case ESP_LOG_WARN: | ||
ESP_LOGW(tag, "%s", message.c_str()); | ||
break; | ||
case ESP_LOG_INFO: | ||
ESP_LOGI(tag, "%s", message.c_str()); | ||
break; | ||
case ESP_LOG_VERBOSE: | ||
ESP_LOGV(tag, "%s", message.c_str()); | ||
break; | ||
case ESP_LOG_DEBUG: | ||
ESP_LOGD(tag, "%s", message.c_str()); | ||
break; | ||
} | ||
} | ||
} // namespace LogHelper | ||
|
||
#endif // __LOG_HELPER_H__ |
Oops, something went wrong.