Skip to content

Commit 9f2b892

Browse files
KonstantinKondrashovespressif-bot
authored andcommitted
feat(log): Move LOG_FORMAT macros out of esp_log.h
1 parent fa3b26b commit 9f2b892

File tree

2 files changed

+23
-8
lines changed

2 files changed

+23
-8
lines changed

components/log/include/esp_log.h

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,18 +16,12 @@
1616
#include "esp_log_buffer.h"
1717
#include "esp_log_timestamp.h"
1818
#include "esp_log_write.h"
19+
#include "esp_log_format.h"
1920

2021
#ifdef __cplusplus
2122
extern "C" {
2223
#endif
2324

24-
/** @cond */
25-
26-
#define LOG_FORMAT(letter, format) LOG_COLOR_ ## letter #letter " (%" PRIu32 ") %s: " format LOG_RESET_COLOR "\n"
27-
#define LOG_SYSTEM_TIME_FORMAT(letter, format) LOG_COLOR_ ## letter #letter " (%s) %s: " format LOG_RESET_COLOR "\n"
28-
29-
/** @endcond */
30-
3125
/// macro to output logs in startup code, before heap allocator and syscalls have been initialized.
3226
/// Log at ``ESP_LOG_ERROR`` level. @see ``printf``,``ESP_LOGE``,``ESP_DRAM_LOGE``
3327

@@ -208,7 +202,6 @@ extern "C" {
208202
#endif // !(defined(__cplusplus) && (__cplusplus > 201703L))
209203

210204
/** @cond */
211-
#define _ESP_LOG_DRAM_LOG_FORMAT(letter, format) DRAM_STR(#letter " %s: " format "\n")
212205

213206
#if defined(__cplusplus) && (__cplusplus > 201703L)
214207
#define ESP_DRAM_LOG_IMPL(tag, format, log_level, log_tag_letter, ...) do { \
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
/*
2+
* SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
#pragma once
8+
9+
#ifdef __cplusplus
10+
extern "C" {
11+
#endif
12+
13+
/** @cond */
14+
// For backward compatibility (these macros are not used in the log v2).
15+
#define LOG_FORMAT(letter, format) LOG_COLOR_ ## letter #letter " (%" PRIu32 ") %s: " format LOG_RESET_COLOR "\n"
16+
#define _ESP_LOG_DRAM_LOG_FORMAT(letter, format) DRAM_STR(#letter " %s: " format "\n")
17+
#define LOG_SYSTEM_TIME_FORMAT(letter, format) LOG_COLOR_ ## letter #letter " (%s) %s: " format LOG_RESET_COLOR "\n"
18+
/** @endcond */
19+
20+
#ifdef __cplusplus
21+
}
22+
#endif

0 commit comments

Comments
 (0)