ra8-firmware 0.1.0
Bare-metal firmware for the Renesas RA8 family (RA8D2 / RA8P1)
Loading...
Searching...
No Matches
esp_log.h File Reference

ESP-IDF-compatible logging surface, implemented by this port. More...

#include <stdint.h>
Include dependency graph for esp_log.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define LOG_LOCAL_LEVEL   ESP_LOG_INFO
 Most verbose level this translation unit is allowed to emit.
#define ESP_LOG_LEVEL_LOCAL(level, tag, ...)
 Emit a line only if this translation unit allows that severity.
#define ESP_LOGE(tag, ...)
 Log a fault the caller cannot recover from itself.
#define ESP_LOGW(tag, ...)
 Log something unexpected that was handled anyway.
#define ESP_LOGI(tag, ...)
 Log a normal life-cycle milestone.
#define ESP_LOGD(tag, ...)
 Log detail useful while bringing the link up.
#define ESP_LOGV(tag, ...)
 Log per-frame or per-edge tracing.
#define ESP_EARLY_LOGE(tag, ...)
 Error-level log usable before the scheduler and inside interrupts.
#define ESP_EARLY_LOGW(tag, ...)
 Warning-level log usable from early or interrupt context.
#define ESP_EARLY_LOGI(tag, ...)
 Info-level log usable from early or interrupt context.
#define ESP_EARLY_LOGD(tag, ...)
 Debug-level log usable from early or interrupt context.
#define ESP_EARLY_LOGV(tag, ...)
 Verbose-level log usable from early or interrupt context.
#define ESP_LOG_BUFFER_HEXDUMP(tag, buf, len, level)
 Dump a buffer as hex at a given severity.
#define esp_log_level_set(tag, level)
 Adjust one module's console threshold at run time.
#define ESP_ERROR_CHECK(x)
 Evaluate an expression and stop the firmware if it is non-zero.
#define ESP_ERROR_CHECK_WITHOUT_ABORT(x)
 Evaluate an expression, report a non-zero result, and carry on.

Enumerations

enum  esp_log_level_t : uint8_t {
  ESP_LOG_NONE = 0 ,
  ESP_LOG_ERROR = 1 ,
  ESP_LOG_WARN = 2 ,
  ESP_LOG_INFO = 3 ,
  ESP_LOG_DEBUG = 4 ,
  ESP_LOG_VERBOSE = 5
}
 Severity of one log line, ordered from silent to most verbose. More...

Functions

void ra8_esp_hosted_log_write (int level, const char *tag, const char *fmt,...)
 Emit one formatted esp-hosted log line.
void ra8_esp_hosted_log_hexdump (int level, const char *tag, const void *buf, uint32_t len)
 Emit a hex dump of a buffer at a given severity.
void ra8_esp_hosted_log_level_set (const char *tag, int level)
 Raise the console threshold for one module at run time.
void ra8_esp_hosted_log_fatal (const char *tag, const char *expr, int code)
 Report a failed ESP_ERROR_CHECK and stop.

Detailed Description

ESP-IDF-compatible logging surface, implemented by this port.

Tag
[Ring 4 / PORT] {World: NS}

The vendored esp-hosted core is written against ESP-IDF and includes esp_log.h by name from eleven translation units. This project does not vendor ESP-IDF, so the name is satisfied here by a first-party header that offers exactly the surface the core uses – and nothing more, because an unused compatibility macro is a promise no one has checked.

One implementation behind every spelling
ESP_LOGx, ESP_EARLY_LOGx, ESP_LOG_LEVEL_LOCAL and ESP_LOG_BUFFER_HEXDUMP are all macros over two functions, ra8_esp_hosted_log_write and ra8_esp_hosted_log_hexdump, defined in port/esp-hosted/src/. There is therefore one place where an esp-hosted log line becomes RA8 console output, one place that decides how a line is framed, and no second formatter to drift.
The early variants are not a separate path
ESP-IDF splits ESP_EARLY_LOGx out because its normal logger is not usable before the scheduler starts or from an interrupt. The vendored code relies on that: spi_drv.c calls ESP_EARLY_LOGV from both side-band edge handlers. This port meets the requirement by making the single writer interrupt-safe rather than by keeping two loggers, so the early spellings are aliases – see the writer's contract below, which is where that obligation is recorded.
Compiling out
A call whose level is more verbose than LOG_LOCAL_LEVEL is guarded by a comparison of two compile-time constants, which the optimiser folds away along with the call and its argument evaluation. It is deliberately not a preprocessor #if: the arguments stay inside a real call expression, so -Wformat=2 keeps checking every vendored call site even at levels this build never emits. A discarded #if would take that checking with it.
Since
0.1.0

Definition in file esp_log.h.

Macro Definition Documentation

◆ ESP_EARLY_LOGD

#define ESP_EARLY_LOGD ( tag,
... )
Value:
ESP_LOG_LEVEL_LOCAL(ESP_LOG_DEBUG, (tag), __VA_ARGS__)
@ ESP_LOG_DEBUG
Detail useful while bringing a link up.
Definition esp_log.h:86
#define ESP_LOG_LEVEL_LOCAL(level, tag,...)
Emit a line only if this translation unit allows that severity.
Definition esp_log.h:291

Debug-level log usable from early or interrupt context.

The same path as ESP_LOGD; see ESP_EARLY_LOGE.

Parameters
[in]tagModule name string.
[in]...Format string followed by its arguments.
Note
Read-only build configuration.
Warning
See ESP_EARLY_LOGE for the interrupt-safety contract.
Example:
ESP_EARLY_LOGD(TAG, "gpio_dr_isr_handler");
#define ESP_EARLY_LOGD(tag,...)
Debug-level log usable from early or interrupt context.
Definition esp_log.h:447
#define TAG
Preserve the tag identifier required by vendored esp-hosted macros.
Since
0.1.0

Definition at line 447 of file esp_log.h.

◆ ESP_EARLY_LOGE

#define ESP_EARLY_LOGE ( tag,
... )
Value:
ESP_LOG_LEVEL_LOCAL(ESP_LOG_ERROR, (tag), __VA_ARGS__)
@ ESP_LOG_ERROR
A fault the caller cannot recover from itself.
Definition esp_log.h:83

Error-level log usable before the scheduler and inside interrupts.

The same path as ESP_LOGE. ESP-IDF needs a separate early logger because its normal one takes a lock; this port's writer is interrupt-safe by contract, so one implementation serves both.

Parameters
[in]tagModule name string.
[in]...Format string followed by its arguments.
Note
Read-only build configuration.
Warning
If the writer ever stops being interrupt-safe, this alias becomes a latent fault in the side-band edge handlers – change the alias, not the handlers.
Example:
ESP_EARLY_LOGE(TAG, "resetting host");
#define ESP_EARLY_LOGE(tag,...)
Error-level log usable before the scheduler and inside interrupts.
Definition esp_log.h:399
Since
0.1.0

Definition at line 399 of file esp_log.h.

◆ ESP_EARLY_LOGI

#define ESP_EARLY_LOGI ( tag,
... )
Value:
ESP_LOG_LEVEL_LOCAL(ESP_LOG_INFO, (tag), __VA_ARGS__)
@ ESP_LOG_INFO
Normal life-cycle milestones.
Definition esp_log.h:85

Info-level log usable from early or interrupt context.

The same path as ESP_LOGI; see ESP_EARLY_LOGE.

Parameters
[in]tagModule name string.
[in]...Format string followed by its arguments.
Note
Read-only build configuration.
Warning
See ESP_EARLY_LOGE for the interrupt-safety contract.
Example:
ESP_EARLY_LOGI(TAG, "boot event seen");
#define ESP_EARLY_LOGI(tag,...)
Info-level log usable from early or interrupt context.
Definition esp_log.h:431
Since
0.1.0

Definition at line 431 of file esp_log.h.

◆ ESP_EARLY_LOGV

#define ESP_EARLY_LOGV ( tag,
... )
Value:
@ ESP_LOG_VERBOSE
Per-frame and per-edge tracing.
Definition esp_log.h:87

Verbose-level log usable from early or interrupt context.

The same path as ESP_LOGV; see ESP_EARLY_LOGE. This is the spelling the vendored SPI driver uses inside both side-band edge handlers, which is what makes the interrupt-safety contract binding.

Parameters
[in]tagModule name string.
[in]...Format string followed by its arguments.
Note
Read-only build configuration.
Warning
Folded out at the default threshold; raising LOG_LOCAL_LEVEL puts formatting inside an interrupt handler.
Example:
ESP_EARLY_LOGV(TAG, "%s", __func__);
#define ESP_EARLY_LOGV(tag,...)
Verbose-level log usable from early or interrupt context.
Definition esp_log.h:466
Since
0.1.0

Definition at line 466 of file esp_log.h.

◆ ESP_EARLY_LOGW

#define ESP_EARLY_LOGW ( tag,
... )
Value:
ESP_LOG_LEVEL_LOCAL(ESP_LOG_WARN, (tag), __VA_ARGS__)
@ ESP_LOG_WARN
Something unexpected that was handled anyway.
Definition esp_log.h:84

Warning-level log usable from early or interrupt context.

The same path as ESP_LOGW; see ESP_EARLY_LOGE.

Parameters
[in]tagModule name string.
[in]...Format string followed by its arguments.
Note
Read-only build configuration.
Warning
See ESP_EARLY_LOGE for the interrupt-safety contract.
Example:
ESP_EARLY_LOGW(TAG, "power save on or reset in progress");
#define ESP_EARLY_LOGW(tag,...)
Warning-level log usable from early or interrupt context.
Definition esp_log.h:415
Since
0.1.0

Definition at line 415 of file esp_log.h.

◆ ESP_ERROR_CHECK

#define ESP_ERROR_CHECK ( x)
Value:
do { \
const int ra8_esp_hosted_rc_ = (int)(x); \
if (ra8_esp_hosted_rc_ != 0) { \
ra8_esp_hosted_log_fatal(TAG, #x, ra8_esp_hosted_rc_); \
} \
} while (0)

Evaluate an expression and stop the firmware if it is non-zero.

ESP-IDF's abort-on-error assertion, kept with its abort semantics: the vendored transport_drv.c uses it as a bounds check on an interface index, so downgrading it to a log would let an out-of-range index through. The expression is evaluated exactly once.

Parameters
[in]xExpression yielding zero on success and a non-zero error code, or a boolean that is true when something is wrong.
Note
Read-only build configuration; ESP-IDF places this macro in esp_err.h, but every vendored user of it also reaches this header, and keeping it beside the logger is what lets it report before it stops.
Warning
Never put a side effect that must happen in a release build inside a construct whose name suggests it is only a check – although, unlike assert, this one always evaluates x.
Example:
ESP_ERROR_CHECK(esp_hosted_spi_set_config(nullptr));
#define ESP_ERROR_CHECK(x)
Evaluate an expression and stop the firmware if it is non-zero.
Definition esp_log.h:535
Since
0.1.0

Definition at line 535 of file esp_log.h.

◆ ESP_ERROR_CHECK_WITHOUT_ABORT

#define ESP_ERROR_CHECK_WITHOUT_ABORT ( x)
Value:
do { \
const int ra8_esp_hosted_rc_ = (int)(x); \
if (ra8_esp_hosted_rc_ != 0) { \
ESP_LOGE(TAG, "%s returned 0x%x", #x, ra8_esp_hosted_rc_); \
} \
} while (0)

Evaluate an expression, report a non-zero result, and carry on.

The recoverable half of ESP_ERROR_CHECK, and the reason both exist: esp_hosted_api.c reconfigures the transport with this one because a failed reconfiguration leaves the previous configuration standing rather than corrupting anything. The expression is evaluated exactly once.

ESP-IDF's version also yields the error code. This one is a statement instead, because yielding a value from a macro needs a GNU statement expression and both vendored call sites discard the result – buying a non-standard construct for a value nothing reads would be the wrong trade. A caller that needs the code should call the function and test it.

Parameters
[in]xExpression yielding zero on success and a non-zero error code.
Note
Read-only build configuration.
Warning
A statement, not an expression; it needs a semicolon and cannot be used in a condition.
Example:
ESP_ERROR_CHECK_WITHOUT_ABORT(esp_hosted_reconfigure());
#define ESP_ERROR_CHECK_WITHOUT_ABORT(x)
Evaluate an expression, report a non-zero result, and carry on.
Definition esp_log.h:567
Since
0.1.0

Definition at line 567 of file esp_log.h.

◆ ESP_LOG_BUFFER_HEXDUMP

#define ESP_LOG_BUFFER_HEXDUMP ( tag,
buf,
len,
level )
Value:
do { \
if ((int)(level) <= (int)LOG_LOCAL_LEVEL) { \
ra8_esp_hosted_log_hexdump((int)(level), (tag), (buf), (uint32_t)(len)); \
} \
} while (0)
#define LOG_LOCAL_LEVEL
Most verbose level this translation unit is allowed to emit.
Definition esp_log.h:114

Dump a buffer as hex at a given severity.

Guarded by the same compile-time threshold as the line macros, so a dump that would be suppressed costs neither the call nor the formatting. The vendored ESP_HEXLOGx helpers expand to this.

Parameters
[in]tagModule name string.
[in]bufStart of the region to dump.
[in]lenBytes to dump.
[in]levelSeverity, an esp_log_level_t value.
Note
Read-only build configuration; the argument order is ESP-IDF's, with the level last.
Warning
A statement, not an expression; it needs a semicolon.
Example:
#define ESP_LOG_BUFFER_HEXDUMP(tag, buf, len, level)
Dump a buffer as hex at a given severity.
Definition esp_log.h:487
Since
0.1.0

Definition at line 487 of file esp_log.h.

◆ ESP_LOG_LEVEL_LOCAL

#define ESP_LOG_LEVEL_LOCAL ( level,
tag,
... )
Value:
do { \
if ((int)(level) <= (int)LOG_LOCAL_LEVEL) { \
ra8_esp_hosted_log_write((int)(level), (tag), __VA_ARGS__); \
} \
} while (0)

Emit a line only if this translation unit allows that severity.

The one macro every other spelling in this header funnels through. The threshold test compares two compile-time constants, so a suppressed call costs nothing at run time while its arguments stay under -Wformat scrutiny.

Parameters
[in]levelSeverity, an esp_log_level_t value.
[in]tagModule name string.
[in]...Format string followed by its arguments.
Note
Read-only build configuration.
Warning
Wrapped in do { } while (0), so it is a statement and needs its own semicolon; it is not usable as an expression.
Example:
Since
0.1.0

Definition at line 291 of file esp_log.h.

◆ esp_log_level_set

#define esp_log_level_set ( tag,
level )
Value:
ra8_esp_hosted_log_level_set((tag), (int)(level))
void ra8_esp_hosted_log_level_set(const char *tag, int level)
Raise the console threshold for one module at run time.

Adjust one module's console threshold at run time.

Routed to ra8_esp_hosted_log_level_set so every ESP-IDF spelling in this header resolves to the port's own logger rather than to a second implementation.

Parameters
[in]tagModule name string to adjust.
[in]levelNew threshold, an esp_log_level_t value.
Note
Read-only build configuration.
Warning
Can only quieten a module, never make it louder than LOG_LOCAL_LEVEL.
Example:
#define esp_log_level_set(tag, level)
Adjust one module's console threshold at run time.
Definition esp_log.h:512
Since
0.1.0

Definition at line 512 of file esp_log.h.

◆ ESP_LOGD

#define ESP_LOGD ( tag,
... )
Value:
ESP_LOG_LEVEL_LOCAL(ESP_LOG_DEBUG, (tag), __VA_ARGS__)

Log detail useful while bringing the link up.

Severity ESP_LOG_DEBUG; folded out at the default threshold.

Parameters
[in]tagModule name string.
[in]...Format string followed by its arguments.
Note
Read-only build configuration.
Warning
A statement, not an expression; it needs a semicolon.
Example:
ESP_LOGD(TAG, "init event length: %u", len);
#define ESP_LOGD(tag,...)
Log detail useful while bringing the link up.
Definition esp_log.h:362
Since
0.1.0

Definition at line 362 of file esp_log.h.

◆ ESP_LOGE

#define ESP_LOGE ( tag,
... )
Value:
ESP_LOG_LEVEL_LOCAL(ESP_LOG_ERROR, (tag), __VA_ARGS__)

Log a fault the caller cannot recover from itself.

Severity ESP_LOG_ERROR. The most-used spelling in the vendored core by a wide margin, and the one level this build never folds out.

Parameters
[in]tagModule name string, normally the file-scope TAG.
[in]...Format string followed by its arguments.
Note
Read-only build configuration.
Warning
A statement, not an expression; it needs a semicolon.
Example:
ESP_LOGE(TAG, "failed to open transport: %d", rc);
#define ESP_LOGE(tag,...)
Log a fault the caller cannot recover from itself.
Definition esp_log.h:313
Since
0.1.0

Definition at line 313 of file esp_log.h.

Referenced by internal_absent(), internal_configure_sideband(), internal_init_hook(), internal_restart_host(), and ra8_esp_hosted_port_init().

◆ ESP_LOGI

#define ESP_LOGI ( tag,
... )
Value:
ESP_LOG_LEVEL_LOCAL(ESP_LOG_INFO, (tag), __VA_ARGS__)

Log a normal life-cycle milestone.

Severity ESP_LOG_INFO, the default LOG_LOCAL_LEVEL, so these are the most verbose lines a stock build emits.

Parameters
[in]tagModule name string.
[in]...Format string followed by its arguments.
Note
Read-only build configuration.
Warning
A statement, not an expression; it needs a semicolon.
Example:
ESP_LOGI(TAG, "co-processor up, fw %u.%u", major, minor);
#define ESP_LOGI(tag,...)
Log a normal life-cycle milestone.
Definition esp_log.h:346
Since
0.1.0

Definition at line 346 of file esp_log.h.

Referenced by ra8_esp_hosted_port_init().

◆ ESP_LOGV

#define ESP_LOGV ( tag,
... )
Value:

Log per-frame or per-edge tracing.

Severity ESP_LOG_VERBOSE; folded out at the default threshold.

Parameters
[in]tagModule name string.
[in]...Format string followed by its arguments.
Note
Read-only build configuration.
Warning
Sits on the hot path. Enabling it changes the timing of the very transactions it reports.
Example:
ESP_LOGV(TAG, "%s", __func__);
#define ESP_LOGV(tag,...)
Log per-frame or per-edge tracing.
Definition esp_log.h:379
Since
0.1.0

Definition at line 379 of file esp_log.h.

◆ ESP_LOGW

#define ESP_LOGW ( tag,
... )
Value:
ESP_LOG_LEVEL_LOCAL(ESP_LOG_WARN, (tag), __VA_ARGS__)

Log something unexpected that was handled anyway.

Severity ESP_LOG_WARN.

Parameters
[in]tagModule name string.
[in]...Format string followed by its arguments.
Note
Read-only build configuration.
Warning
A statement, not an expression; it needs a semicolon.
Example:
ESP_LOGW(TAG, "dropping unknown event %u", evt);
#define ESP_LOGW(tag,...)
Log something unexpected that was handled anyway.
Definition esp_log.h:329
Since
0.1.0

Definition at line 329 of file esp_log.h.

Referenced by internal_config_host_power_save(), and internal_start_host_power_save().

◆ LOG_LOCAL_LEVEL

#define LOG_LOCAL_LEVEL   ESP_LOG_INFO

Most verbose level this translation unit is allowed to emit.

ESP_LOG_INFO by default: life-cycle milestones and everything more severe reach the console, while the per-frame and per-edge tracing that would swamp a 115200-baud console – and change the timing of the link it is describing – is folded out. A translation unit that is being debugged may define this to a more verbose level before including this header, which is the ESP-IDF contract and the reason for the guard.

Note
Read-only build configuration. It is an enumerator, not a preprocessor integer, so it must not be used in an #if.
Warning
Raising this to ESP_LOG_VERBOSE turns on logging inside the two side-band interrupt handlers; that is legal here but it will dominate the interrupt latency the link is being measured for.
Example:
#define LOG_LOCAL_LEVEL ESP_LOG_DEBUG
#include "esp_log.h"
ESP-IDF-compatible logging surface, implemented by this port.
Since
0.1.0

Definition at line 114 of file esp_log.h.

Enumeration Type Documentation

◆ esp_log_level_t

enum esp_log_level_t : uint8_t

Severity of one log line, ordered from silent to most verbose.

Numerically ordered so that "emit this line" is the single comparison level <= LOG_LOCAL_LEVEL. The values match ESP-IDF's, which matters because esp_hosted_log.h passes them around as plain integers and because a co-processor log capture read next to a host capture should use one scale.

Invariant
ESP_LOG_NONE is zero and is never passed to the writer; it only ever appears as a threshold meaning "emit nothing".
The values are strictly increasing with verbosity, which is what makes the threshold test a single comparison.
Example:
See also
LOG_LOCAL_LEVEL
ra8_esp_hosted_log_write
Since
0.1.0
Enumerator
ESP_LOG_NONE 

Threshold only: suppress every line.

ESP_LOG_ERROR 

A fault the caller cannot recover from itself.

ESP_LOG_WARN 

Something unexpected that was handled anyway.

ESP_LOG_INFO 

Normal life-cycle milestones.

ESP_LOG_DEBUG 

Detail useful while bringing a link up.

ESP_LOG_VERBOSE 

Per-frame and per-edge tracing.

Definition at line 81 of file esp_log.h.

Function Documentation

◆ ra8_esp_hosted_log_fatal()

void ra8_esp_hosted_log_fatal ( const char * tag,
const char * expr,
int code )

Report a failed ESP_ERROR_CHECK and stop.

The abort half of ESP_ERROR_CHECK. ESP-IDF's macro aborts on a non-zero result and the vendored core depends on that: transport_drv.c writes ESP_ERROR_CHECK(if_type >= ESP_MAX_IF) as a bounds assertion, so a version that merely logged would let an out-of-range interface index through. The implementation logs at ESP_LOG_ERROR and hands over to the firmware's fault path.

Parameters
[in]tagModule name of the failing call site. Never null.
[in]exprStringised expression that failed. Never null.
[in]codeThe non-zero result the expression produced.
Returns
This function does not return.
Precondition
tag and expr are non-null, null-terminated strings.
code is non-zero; a zero result is not a failure and must not reach here.
Postcondition
Control never returns to the caller.
The failure has been reported before control is surrendered.
Note
Callable from any context, including an interrupt handler.
Warning
This is a hard stop, not an exception. Use ESP_ERROR_CHECK_WITHOUT_ABORT where the caller can carry on.
Example:
ra8_esp_hosted_log_fatal("H_transport", "rpc_init()", rc);
void ra8_esp_hosted_log_fatal(const char *tag, const char *expr, int code)
Report a failed ESP_ERROR_CHECK and stop.
See also
ra8_esp_hosted_log_write
Since
0.1.0

Report a failed ESP_ERROR_CHECK and stop.

Definition at line 240 of file ra8_esp_hosted_log.c.

References ESP_LOG_ERROR, ra8_esp_hosted_log_write(), and s_ra8_esp_hosted_log_tag.

◆ ra8_esp_hosted_log_hexdump()

void ra8_esp_hosted_log_hexdump ( int level,
const char * tag,
const void * buf,
uint32_t len )

Emit a hex dump of a buffer at a given severity.

Backs ESP_LOG_BUFFER_HEXDUMP, which the vendored esp_hosted_log.h builds its ESP_HEXLOGx helpers on. The implementation decides the row width and whether an ASCII gutter is printed; the core only supplies the bytes.

Parameters
[in]levelSeverity as an int, carrying an esp_log_level_t value.
[in]tagModule name. Never null.
[in]bufStart of the region to dump. May be null only when len is zero.
[in]lenBytes to dump, starting at buf.
Precondition
tag is a non-null, null-terminated string.
buf points to at least len readable bytes.
Postcondition
The buffer is not modified.
Output is bounded by len; the implementation truncates rather than growing an unbounded line.
Note
Callers already clamp the length: the vendored helper takes the lesser of the buffer length and a display length before calling.
Warning
Dumping a whole 1600-byte frame is a hundred console lines. Clamp at the call site, as the vendored helpers do.
Example:
void ra8_esp_hosted_log_hexdump(int level, const char *tag, const void *buf, uint32_t len)
Emit a hex dump of a buffer at a given severity.
See also
ra8_esp_hosted_log_write
Since
0.1.0

Emit a hex dump of a buffer at a given severity.

Definition at line 175 of file ra8_esp_hosted_log.c.

References internal_emit(), k_ra8_esp_hosted_fmt_digits_max, k_ra8_esp_hosted_log_dump_bytes, k_ra8_esp_hosted_log_dump_cost, k_ra8_esp_hosted_log_dump_nibbles, k_ra8_esp_hosted_log_dump_radix, k_ra8_esp_hosted_log_line_max, priv_ra8_esp_hosted_fmt_utoa(), priv_ra8_esp_hosted_log_accepts(), and s_ra8_esp_hosted_log_tag.

◆ ra8_esp_hosted_log_level_set()

void ra8_esp_hosted_log_level_set ( const char * tag,
int level )

Raise the console threshold for one module at run time.

Backs esp_log_level_set, which esp_hosted_api.c calls during initialisation to quieten the three RPC modules. The implementation keeps a small fixed table of overrides; a tag it has no room for keeps the compile-time LOG_LOCAL_LEVEL rather than displacing another entry.

Parameters
[in]tagModule name to adjust. Never null. Note that the vendored caller passes unprefixed names, which do not match the H_-prefixed tags DEFINE_LOG_TAG produces.
[in]levelNew threshold as an int carrying an esp_log_level_t value; ESP_LOG_NONE silences the module completely.
Precondition
tag is a non-null, null-terminated string.
level is within ESP_LOG_NONE .. ESP_LOG_VERBOSE.
Postcondition
Subsequent lines from a matching tag are filtered at level.
No line already emitted is affected.
Note
Safe to call before the console sink exists; the override table is plain data.
Warning
The override can only make a module quieter than the compile-time threshold, never louder: the macros still fold out anything above LOG_LOCAL_LEVEL before the call is reached.
Example:
See also
LOG_LOCAL_LEVEL
Since
0.1.0

Raise the console threshold for one module at run time.

Definition at line 217 of file ra8_esp_hosted_log.c.

References ESP_LOG_NONE, ESP_LOG_VERBOSE, and s_ra8_esp_hosted_log_level.

◆ ra8_esp_hosted_log_write()

void ra8_esp_hosted_log_write ( int level,
const char * tag,
const char * fmt,
... )

Emit one formatted esp-hosted log line.

The single entry point behind every ESP_LOGx spelling in this header. The implementation in port/esp-hosted/src/ prefixes the severity and the tag, formats the body and hands the result to the firmware's console sink.

Parameters
[in]levelSeverity as an int, carrying an esp_log_level_t value in the range ESP_LOG_ERROR .. ESP_LOG_VERBOSE. Taken as int because the vendored hex-dump helper passes the level through an untyped macro parameter.
[in]tagModule name, already carrying the H_ prefix that DEFINE_LOG_TAG adds. Never null; the macros always supply the file-scope TAG.
[in]fmtprintf-style format string. Never null.
[in]...Arguments matching fmt.
Precondition
tag and fmt are non-null, null-terminated strings.
The console sink has been initialised, or the call is discarded rather than writing to an unconfigured peripheral.
Postcondition
At most one line is emitted; nothing else observable changes.
The caller's arguments are unmodified.
Note
Must be safe to call from interrupt context: the vendored SPI driver logs from both side-band edge handlers through ESP_EARLY_LOGV, and this port maps those onto this function rather than onto a second logger.
Warning
Formatting is not free. At ESP_LOG_VERBOSE this sits on the per-frame path, so a slow console sink becomes the link's bottleneck.
Example:
ra8_esp_hosted_log_write(ESP_LOG_INFO, "H_spi", "clk %u MHz", clk);
void ra8_esp_hosted_log_write(int level, const char *tag, const char *fmt,...)
Emit one formatted esp-hosted log line.
See also
ra8_esp_hosted_log_hexdump
Since
0.1.0

Emit one formatted esp-hosted log line.

Definition at line 165 of file ra8_esp_hosted_log.c.

References priv_ra8_esp_hosted_log_vwrite().

Referenced by ra8_esp_hosted_alloc_failed(), ra8_esp_hosted_log_fatal(), and ra8_esp_hosted_mem_dump().