| 2 |
raymond |
1 |
// SPDX-License-Identifier: LGPL-3.0-or-later
|
|
|
2 |
// Copyright 2016-2026 Hristo Gochkov, Mathieu Carbou, Emil Muratov, Will Miles
|
|
|
3 |
|
|
|
4 |
#pragma once
|
|
|
5 |
|
|
|
6 |
#ifdef CONFIG_ASYNC_TCP_LOG_CUSTOM
|
|
|
7 |
// The user must provide the following macros in AsyncTCPLoggingCustom.h:
|
|
|
8 |
// async_tcp_log_e, async_tcp_log_w, async_tcp_log_i, async_tcp_log_d, async_tcp_log_v
|
|
|
9 |
#include <AsyncTCPLoggingCustom.h>
|
|
|
10 |
|
|
|
11 |
#elif defined(CONFIG_ASYNC_TCP_DEBUG)
|
|
|
12 |
// Local Debug logging
|
|
|
13 |
#include <HardwareSerial.h>
|
|
|
14 |
#define async_tcp_log_e(format, ...) Serial.printf("E async_tcp %s() %d: " format, __FUNCTION__, __LINE__, ##__VA_ARGS__);
|
|
|
15 |
#define async_tcp_log_w(format, ...) Serial.printf("W async_tcp %s() %d: " format, __FUNCTION__, __LINE__, ##__VA_ARGS__);
|
|
|
16 |
#define async_tcp_log_i(format, ...) Serial.printf("I async_tcp %s() %d: " format, __FUNCTION__, __LINE__, ##__VA_ARGS__);
|
|
|
17 |
#define async_tcp_log_d(format, ...) Serial.printf("D async_tcp %s() %d: " format, __FUNCTION__, __LINE__, ##__VA_ARGS__);
|
|
|
18 |
#define async_tcp_log_v(format, ...) Serial.printf("V async_tcp %s() %d: " format, __FUNCTION__, __LINE__, ##__VA_ARGS__);
|
|
|
19 |
|
|
|
20 |
#else
|
|
|
21 |
// Framework-based logging
|
|
|
22 |
|
|
|
23 |
/**
|
|
|
24 |
* LibreTiny specific configurations
|
|
|
25 |
*/
|
|
|
26 |
#if defined(LIBRETINY)
|
|
|
27 |
#include <Arduino.h>
|
|
|
28 |
#define async_tcp_log_e(format, ...) log_e(format, ##__VA_ARGS__)
|
|
|
29 |
#define async_tcp_log_w(format, ...) log_w(format, ##__VA_ARGS__)
|
|
|
30 |
#define async_tcp_log_i(format, ...) log_i(format, ##__VA_ARGS__)
|
|
|
31 |
#define async_tcp_log_d(format, ...) log_d(format, ##__VA_ARGS__)
|
|
|
32 |
#define async_tcp_log_v(format, ...) log_v(format, ##__VA_ARGS__)
|
|
|
33 |
|
|
|
34 |
/**
|
|
|
35 |
* Arduino specific configurations
|
|
|
36 |
*/
|
|
|
37 |
#elif defined(ARDUINO)
|
|
|
38 |
#if defined(USE_ESP_IDF_LOG)
|
|
|
39 |
#include <esp_log.h>
|
|
|
40 |
#define async_tcp_log_e(format, ...) ESP_LOGE("async_tcp", "%s() %d: " format, __FUNCTION__, __LINE__, ##__VA_ARGS__)
|
|
|
41 |
#define async_tcp_log_w(format, ...) ESP_LOGW("async_tcp", "%s() %d: " format, __FUNCTION__, __LINE__, ##__VA_ARGS__)
|
|
|
42 |
#define async_tcp_log_i(format, ...) ESP_LOGI("async_tcp", "%s() %d: " format, __FUNCTION__, __LINE__, ##__VA_ARGS__)
|
|
|
43 |
#define async_tcp_log_d(format, ...) ESP_LOGD("async_tcp", "%s() %d: " format, __FUNCTION__, __LINE__, ##__VA_ARGS__)
|
|
|
44 |
#define async_tcp_log_v(format, ...) ESP_LOGV("async_tcp", "%s() %d: " format, __FUNCTION__, __LINE__, ##__VA_ARGS__)
|
|
|
45 |
#else
|
|
|
46 |
#include <esp32-hal-log.h>
|
|
|
47 |
#define async_tcp_log_e(format, ...) log_e(format, ##__VA_ARGS__)
|
|
|
48 |
#define async_tcp_log_w(format, ...) log_w(format, ##__VA_ARGS__)
|
|
|
49 |
#define async_tcp_log_i(format, ...) log_i(format, ##__VA_ARGS__)
|
|
|
50 |
#define async_tcp_log_d(format, ...) log_d(format, ##__VA_ARGS__)
|
|
|
51 |
#define async_tcp_log_v(format, ...) log_v(format, ##__VA_ARGS__)
|
|
|
52 |
#endif // USE_ESP_IDF_LOG
|
|
|
53 |
|
|
|
54 |
/**
|
|
|
55 |
* ESP-IDF specific configurations
|
|
|
56 |
*/
|
|
|
57 |
#else
|
|
|
58 |
#include <esp_log.h>
|
|
|
59 |
#define async_tcp_log_e(format, ...) ESP_LOGE("async_tcp", "%s() %d: " format, __FUNCTION__, __LINE__, ##__VA_ARGS__)
|
|
|
60 |
#define async_tcp_log_w(format, ...) ESP_LOGW("async_tcp", "%s() %d: " format, __FUNCTION__, __LINE__, ##__VA_ARGS__)
|
|
|
61 |
#define async_tcp_log_i(format, ...) ESP_LOGI("async_tcp", "%s() %d: " format, __FUNCTION__, __LINE__, ##__VA_ARGS__)
|
|
|
62 |
#define async_tcp_log_d(format, ...) ESP_LOGD("async_tcp", "%s() %d: " format, __FUNCTION__, __LINE__, ##__VA_ARGS__)
|
|
|
63 |
#define async_tcp_log_v(format, ...) ESP_LOGV("async_tcp", "%s() %d: " format, __FUNCTION__, __LINE__, ##__VA_ARGS__)
|
|
|
64 |
#endif // !LIBRETINY && !ARDUINO
|
|
|
65 |
|
|
|
66 |
#endif // CONFIG_ASYNC_TCP_LOG_CUSTOM
|