|
| 1 | +/**************************************************************************************************************************** |
| 2 | + AsyncHTTPSRequest_Debug_Generic.h |
| 3 | + |
| 4 | + For ESP32, ESP8266 and STM32 with built-in LAN8742A Ethernet (Nucleo-144, DISCOVERY, etc) |
| 5 | + |
| 6 | + AsyncHTTPSRequest is a library for the ESP8266, ESP32 and currently STM32 run built-in Ethernet WebServer |
| 7 | + |
| 8 | + Based on and modified from AsyncHTTPRequest Library (https://github.com/boblemaire/asyncHTTPrequest) |
| 9 | + |
| 10 | + Built by Khoi Hoang https://github.com/khoih-prog/AsyncHTTPSRequest_Generic |
| 11 | + |
| 12 | + Copyright (C) <2018> <Bob Lemaire, IoTaWatt, Inc.> |
| 13 | + This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License |
| 14 | + as published bythe Free Software Foundation, either version 3 of the License, or (at your option) any later version. |
| 15 | + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 16 | + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. |
| 17 | + You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>. |
| 18 | + |
| 19 | + Version: 1.2.0 |
| 20 | + |
| 21 | + Version Modified By Date Comments |
| 22 | + ------- ----------- ---------- ----------- |
| 23 | + 1.0.0 K Hoang 21/10/2021 Initial coding to support only ESP32 |
| 24 | + 1.1.0 K Hoang 23/10/2021 Add support to ESP32-based WT32-ETH01 using LAN8720 |
| 25 | + 1.1.1 K Hoang 29/11/2021 Auto detect ESP32 core version and improve connection time for WT32_ETH01 |
| 26 | + 1.2.0 K Hoang 30/12/2021 Fix `multiple-definitions` linker error |
| 27 | + *****************************************************************************************************************************/ |
| 28 | + |
| 29 | +#pragma once |
| 30 | + |
| 31 | +#ifndef ASYNC_HTTPS_REQUEST_DEBUG_GENERIC_H |
| 32 | +#define ASYNC_HTTPS_REQUEST_DEBUG_GENERIC_H |
| 33 | + |
| 34 | +#ifdef ASYNC_HTTPS_DEBUG_PORT |
| 35 | + #define A_DBG_PORT ASYNC_HTTPS_DEBUG_PORT |
| 36 | +#else |
| 37 | + #define A_DBG_PORT Serial |
| 38 | +#endif |
| 39 | + |
| 40 | +// Change _ASYNC_HTTPS_LOGLEVEL_ to set tracing and logging verbosity |
| 41 | +// 0: DISABLED: no logging |
| 42 | +// 1: ERROR: errors |
| 43 | +// 2: WARN: errors and warnings |
| 44 | +// 3: INFO: errors, warnings and informational (default) |
| 45 | +// 4: DEBUG: errors, warnings, informational and debug |
| 46 | + |
| 47 | +#ifndef _ASYNC_HTTPS_LOGLEVEL_ |
| 48 | + #define _ASYNC_HTTPS_LOGLEVEL_ 0 |
| 49 | +#endif |
| 50 | + |
| 51 | +///////////////////////////////////////////////////////// |
| 52 | + |
| 53 | +const char AHTTPS_MARK[] = "[AHTTPS] "; |
| 54 | + |
| 55 | +#define AHTTPS_PRINT_MARK AHTTPS_PRINT(AHTTPS_MARK) |
| 56 | +#define AHTTPS_PRINT_SP A_DBG_PORT.print(" ") |
| 57 | + |
| 58 | +#define AHTTPS_PRINT A_DBG_PORT.print |
| 59 | +#define AHTTPS_PRINTLN A_DBG_PORT.println |
| 60 | + |
| 61 | +///////////////////////////////////////////////////////// |
| 62 | + |
| 63 | +#define AHTTPS_LOGERROR(x) if(_ASYNC_HTTPS_LOGLEVEL_>0) { AHTTPS_PRINT_MARK; AHTTPS_PRINTLN(x); } |
| 64 | +#define AHTTPS_LOGERROR0(x) if(_ASYNC_HTTPS_LOGLEVEL_>0) { AHTTPS_PRINT(x); } |
| 65 | +#define AHTTPS_LOGERROR1(x,y) if(_ASYNC_HTTPS_LOGLEVEL_>0) { AHTTPS_PRINT_MARK; AHTTPS_PRINT(x); AHTTPS_PRINT_SP; AHTTPS_PRINTLN(y); } |
| 66 | +#define AHTTPS_LOGERROR2(x,y,z) if(_ASYNC_HTTPS_LOGLEVEL_>0) { AHTTPS_PRINT_MARK; AHTTPS_PRINT(x); AHTTPS_PRINT_SP; AHTTPS_PRINT(y); AHTTPS_PRINT_SP; AHTTPS_PRINTLN(z); } |
| 67 | +#define AHTTPS_LOGERROR3(x,y,z,w) if(_ASYNC_HTTPS_LOGLEVEL_>0) { AHTTPS_PRINT_MARK; AHTTPS_PRINT(x); AHTTPS_PRINT_SP; AHTTPS_PRINT(y); AHTTPS_PRINT_SP; AHTTPS_PRINT(z); AHTTPS_PRINT_SP; AHTTPS_PRINTLN(w); } |
| 68 | + |
| 69 | +///////////////////////////////////////////////////////// |
| 70 | + |
| 71 | +#define AHTTPS_LOGWARN(x) if(_ASYNC_HTTPS_LOGLEVEL_>1) { AHTTPS_PRINT_MARK; AHTTPS_PRINTLN(x); } |
| 72 | +#define AHTTPS_LOGWARN0(x) if(_ASYNC_HTTPS_LOGLEVEL_>1) { AHTTPS_PRINT(x); } |
| 73 | +#define AHTTPS_LOGWARN1(x,y) if(_ASYNC_HTTPS_LOGLEVEL_>1) { AHTTPS_PRINT_MARK; AHTTPS_PRINT(x); AHTTPS_PRINT_SP; AHTTPS_PRINTLN(y); } |
| 74 | +#define AHTTPS_LOGWARN2(x,y,z) if(_ASYNC_HTTPS_LOGLEVEL_>1) { AHTTPS_PRINT_MARK; AHTTPS_PRINT(x); AHTTPS_PRINT_SP; AHTTPS_PRINT(y); AHTTPS_PRINT_SP; AHTTPS_PRINTLN(z); } |
| 75 | +#define AHTTPS_LOGWARN3(x,y,z,w) if(_ASYNC_HTTPS_LOGLEVEL_>1) { AHTTPS_PRINT_MARK; AHTTPS_PRINT(x); AHTTPS_PRINT_SP; AHTTPS_PRINT(y); AHTTPS_PRINT_SP; AHTTPS_PRINT(z); AHTTPS_PRINT_SP; AHTTPS_PRINTLN(w); } |
| 76 | + |
| 77 | +///////////////////////////////////////////////////////// |
| 78 | + |
| 79 | +#define AHTTPS_LOGINFO(x) if(_ASYNC_HTTPS_LOGLEVEL_>2) { AHTTPS_PRINT_MARK; AHTTPS_PRINTLN(x); } |
| 80 | +#define AHTTPS_LOGINFO0(x) if(_ASYNC_HTTPS_LOGLEVEL_>2) { AHTTPS_PRINT(x); } |
| 81 | +#define AHTTPS_LOGINFO1(x,y) if(_ASYNC_HTTPS_LOGLEVEL_>2) { AHTTPS_PRINT_MARK; AHTTPS_PRINT(x); AHTTPS_PRINT_SP; AHTTPS_PRINTLN(y); } |
| 82 | +#define AHTTPS_LOGINFO2(x,y,z) if(_ASYNC_HTTPS_LOGLEVEL_>2) { AHTTPS_PRINT_MARK; AHTTPS_PRINT(x); AHTTPS_PRINT_SP; AHTTPS_PRINT(y); AHTTPS_PRINT_SP; AHTTPS_PRINTLN(z); } |
| 83 | +#define AHTTPS_LOGINFO3(x,y,z,w) if(_ASYNC_HTTPS_LOGLEVEL_>2) { AHTTPS_PRINT_MARK; AHTTPS_PRINT(x); AHTTPS_PRINT_SP; AHTTPS_PRINT(y); AHTTPS_PRINT_SP; AHTTPS_PRINT(z); AHTTPS_PRINT_SP; AHTTPS_PRINTLN(w); } |
| 84 | + |
| 85 | +///////////////////////////////////////////////////////// |
| 86 | + |
| 87 | +#define AHTTPS_LOGDEBUG(x) if(_ASYNC_HTTPS_LOGLEVEL_>3) { AHTTPS_PRINT_MARK; AHTTPS_PRINTLN(x); } |
| 88 | +#define AHTTPS_LOGDEBUG0(x) if(_ASYNC_HTTPS_LOGLEVEL_>3) { AHTTPS_PRINT(x); } |
| 89 | +#define AHTTPS_LOGDEBUG1(x,y) if(_ASYNC_HTTPS_LOGLEVEL_>3) { AHTTPS_PRINT_MARK; AHTTPS_PRINT(x); AHTTPS_PRINT_SP; AHTTPS_PRINTLN(y); } |
| 90 | +#define AHTTPS_LOGDEBUG2(x,y,z) if(_ASYNC_HTTPS_LOGLEVEL_>3) { AHTTPS_PRINT_MARK; AHTTPS_PRINT(x); AHTTPS_PRINT_SP; AHTTPS_PRINT(y); AHTTPS_PRINT_SP; AHTTPS_PRINTLN(z); } |
| 91 | +#define AHTTPS_LOGDEBUG3(x,y,z,w) if(_ASYNC_HTTPS_LOGLEVEL_>3) { AHTTPS_PRINT_MARK; AHTTPS_PRINT(x); AHTTPS_PRINT_SP; AHTTPS_PRINT(y); AHTTPS_PRINT_SP; AHTTPS_PRINT(z); AHTTPS_PRINT_SP; AHTTPS_PRINTLN(w); } |
| 92 | + |
| 93 | +///////////////////////////////////////////////////////// |
| 94 | + |
| 95 | +#endif // ASYNC_HTTPS_REQUEST_DEBUG_GENERIC_H |
| 96 | + |
0 commit comments