a59eafbc9d
* fix sdmmc config * Fix warnings in EEPROM from @Curclamas * remove leftover TAG in EEPROM * Initial add of @stickbreaker i2c * Add log_n * fix warnings when log is off * i2c code clean up and reorganization * add flags to interrupt allocator * fix sdmmc config * Fix warnings in EEPROM from @Curclamas * remove leftover TAG in EEPROM * fix errors with latest IDF * fix debug optimization (#1365) incorrect optimization for debugging tick markers. * Fix some missing BT header * Change BTSerial log calls * Update BLE lib * Arduino-ESP32 release management scripted (#1515) * Calculate an absolute path for a custom partitions table (#1452) * * Arduino-ESP32 release management scripted (ready-to-merge) * * secure env for espressif/arduino-esp32 * * build tests enabled * gitter webhook enabled * * gitter room link fixed * better comment * * filepaths fixed * BT Serial adjustments * * don't run sketch builds & tests for tagged builds * Return false from WiFi.hostByName() if hostname is not resolved * Free BT Memory when BT is not used * WIFI_MODE_NULL is not supported anymore * Select some key examples to build with PlatformIO to save some time * Update BLE lib * Fixed BLE lib * Major WiFi overhaul - auto reconnect on connection loss now works - moved to event groups - some code clean up and procedure optimizations - new methods to get a more elaborate system ststus * Add cmake tests to travis * Add initial AsyncUDP * Add NetBIOS lib and fix CMake includes * Add Initial WebServer * Fix WebServer and examples * travis not quiting on build fail * Try different travis build * Update IDF to aaf1239 * Fix WPS Example * fix script permission and add some fail tests to sketch builder * Add missing space in WiFiClient::write(Stream &stream)
137 lines
4.2 KiB
C
137 lines
4.2 KiB
C
// Copyright 2015-2016 Espressif Systems (Shanghai) PTE LTD
|
|
//
|
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
// you may not use this file except in compliance with the License.
|
|
// You may obtain a copy of the License at
|
|
|
|
// http://www.apache.org/licenses/LICENSE-2.0
|
|
//
|
|
// Unless required by applicable law or agreed to in writing, software
|
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
// See the License for the specific language governing permissions and
|
|
// limitations under the License.
|
|
#ifndef __ARDUHAL_LOG_H__
|
|
#define __ARDUHAL_LOG_H__
|
|
|
|
#ifdef __cplusplus
|
|
extern "C"
|
|
{
|
|
#endif
|
|
|
|
#include "sdkconfig.h"
|
|
|
|
#define ARDUHAL_LOG_LEVEL_NONE (0)
|
|
#define ARDUHAL_LOG_LEVEL_ERROR (1)
|
|
#define ARDUHAL_LOG_LEVEL_WARN (2)
|
|
#define ARDUHAL_LOG_LEVEL_INFO (3)
|
|
#define ARDUHAL_LOG_LEVEL_DEBUG (4)
|
|
#define ARDUHAL_LOG_LEVEL_VERBOSE (5)
|
|
|
|
#ifndef CONFIG_ARDUHAL_LOG_DEFAULT_LEVEL
|
|
#define CONFIG_ARDUHAL_LOG_DEFAULT_LEVEL ARDUHAL_LOG_LEVEL_NONE
|
|
#endif
|
|
|
|
#ifndef CORE_DEBUG_LEVEL
|
|
#define ARDUHAL_LOG_LEVEL CONFIG_ARDUHAL_LOG_DEFAULT_LEVEL
|
|
#else
|
|
#define ARDUHAL_LOG_LEVEL CORE_DEBUG_LEVEL
|
|
#endif
|
|
|
|
#ifndef CONFIG_ARDUHAL_LOG_COLORS
|
|
#define CONFIG_ARDUHAL_LOG_COLORS 0
|
|
#endif
|
|
|
|
#if CONFIG_ARDUHAL_LOG_COLORS
|
|
#define ARDUHAL_LOG_COLOR_BLACK "30"
|
|
#define ARDUHAL_LOG_COLOR_RED "31" //ERROR
|
|
#define ARDUHAL_LOG_COLOR_GREEN "32" //INFO
|
|
#define ARDUHAL_LOG_COLOR_YELLOW "33" //WARNING
|
|
#define ARDUHAL_LOG_COLOR_BLUE "34"
|
|
#define ARDUHAL_LOG_COLOR_MAGENTA "35"
|
|
#define ARDUHAL_LOG_COLOR_CYAN "36" //DEBUG
|
|
#define ARDUHAL_LOG_COLOR_GRAY "37" //VERBOSE
|
|
#define ARDUHAL_LOG_COLOR_WHITE "38"
|
|
|
|
#define ARDUHAL_LOG_COLOR(COLOR) "\033[0;" COLOR "m"
|
|
#define ARDUHAL_LOG_BOLD(COLOR) "\033[1;" COLOR "m"
|
|
#define ARDUHAL_LOG_RESET_COLOR "\033[0m"
|
|
|
|
#define ARDUHAL_LOG_COLOR_E ARDUHAL_LOG_COLOR(ARDUHAL_LOG_COLOR_RED)
|
|
#define ARDUHAL_LOG_COLOR_W ARDUHAL_LOG_COLOR(ARDUHAL_LOG_COLOR_YELLOW)
|
|
#define ARDUHAL_LOG_COLOR_I ARDUHAL_LOG_COLOR(ARDUHAL_LOG_COLOR_GREEN)
|
|
#define ARDUHAL_LOG_COLOR_D ARDUHAL_LOG_COLOR(ARDUHAL_LOG_COLOR_CYAN)
|
|
#define ARDUHAL_LOG_COLOR_V ARDUHAL_LOG_COLOR(ARDUHAL_LOG_COLOR_GRAY)
|
|
#else
|
|
#define ARDUHAL_LOG_COLOR_E
|
|
#define ARDUHAL_LOG_COLOR_W
|
|
#define ARDUHAL_LOG_COLOR_I
|
|
#define ARDUHAL_LOG_COLOR_D
|
|
#define ARDUHAL_LOG_COLOR_V
|
|
#define ARDUHAL_LOG_RESET_COLOR
|
|
#endif
|
|
|
|
const char * pathToFileName(const char * path);
|
|
int log_printf(const char *fmt, ...);
|
|
|
|
#define ARDUHAL_SHORT_LOG_FORMAT(letter, format) ARDUHAL_LOG_COLOR_ ## letter format ARDUHAL_LOG_RESET_COLOR "\r\n"
|
|
#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__
|
|
|
|
#if ARDUHAL_LOG_LEVEL >= ARDUHAL_LOG_LEVEL_VERBOSE
|
|
#define log_v(format, ...) log_printf(ARDUHAL_LOG_FORMAT(V, format), ##__VA_ARGS__)
|
|
#else
|
|
#define log_v(format, ...)
|
|
#endif
|
|
|
|
#if ARDUHAL_LOG_LEVEL >= ARDUHAL_LOG_LEVEL_DEBUG
|
|
#define log_d(format, ...) log_printf(ARDUHAL_LOG_FORMAT(D, format), ##__VA_ARGS__)
|
|
#else
|
|
#define log_d(format, ...)
|
|
#endif
|
|
|
|
#if ARDUHAL_LOG_LEVEL >= ARDUHAL_LOG_LEVEL_INFO
|
|
#define log_i(format, ...) log_printf(ARDUHAL_LOG_FORMAT(I, format), ##__VA_ARGS__)
|
|
#else
|
|
#define log_i(format, ...)
|
|
#endif
|
|
|
|
#if ARDUHAL_LOG_LEVEL >= ARDUHAL_LOG_LEVEL_WARN
|
|
#define log_w(format, ...) log_printf(ARDUHAL_LOG_FORMAT(W, format), ##__VA_ARGS__)
|
|
#else
|
|
#define log_w(format, ...)
|
|
#endif
|
|
|
|
#if ARDUHAL_LOG_LEVEL >= ARDUHAL_LOG_LEVEL_ERROR
|
|
#define log_e(format, ...) log_printf(ARDUHAL_LOG_FORMAT(E, format), ##__VA_ARGS__)
|
|
#else
|
|
#define log_e(format, ...)
|
|
#endif
|
|
|
|
#if ARDUHAL_LOG_LEVEL >= ARDUHAL_LOG_LEVEL_NONE
|
|
#define log_n(format, ...) log_printf(ARDUHAL_LOG_FORMAT(E, format), ##__VA_ARGS__)
|
|
#else
|
|
#define log_n(format, ...)
|
|
#endif
|
|
|
|
#include "esp_log.h"
|
|
|
|
#ifdef CONFIG_ARDUHAL_ESP_LOG
|
|
#undef ESP_LOGE
|
|
#undef ESP_LOGW
|
|
#undef ESP_LOGI
|
|
#undef ESP_LOGD
|
|
#undef ESP_LOGV
|
|
|
|
#define ESP_LOGE(tag, ...) log_e(__VA_ARGS__)
|
|
#define ESP_LOGW(tag, ...) log_w(__VA_ARGS__)
|
|
#define ESP_LOGI(tag, ...) log_i(__VA_ARGS__)
|
|
#define ESP_LOGD(tag, ...) log_d(__VA_ARGS__)
|
|
#define ESP_LOGV(tag, ...) log_v(__VA_ARGS__)
|
|
#endif
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
#endif /* __ESP_LOGGING_H__ */
|