17void host_log(uint8_t level,
const char* tag,
const char* msg)
19 if (!tag) tag =
"plugin";
26 default:
LOG_V(tag,
"%s", msg);
break;
30void host_log_hex(
const char* tag,
const char* label,
const uint8_t* data,
size_t len)
32 if (!tag) tag =
"plugin";
33 if (!label) label =
"";
34 LOG_I(tag,
"%s (%zu bytes)", label, len);
38 size_t chunk = (len - off) > 16 ? 16 : (len - off);
40 for (
size_t i = 0; i < chunk; ++i) {
41 written += std::snprintf(line + written,
sizeof(line) - written,
42 "%02X ", data[off + i]);
44 LOG_I(tag,
" %04zu %s", off, line);
CDC Log: logging over TinyUSB CDC and UART.
#define LOG_W(tag, fmt,...)
#define LOG_D(tag, fmt,...)
#define LOG_I(tag, fmt,...)
#define LOG_V(tag, fmt,...)
#define LOG_E(tag, fmt,...)
void host_log_hex(const char *tag, const char *label, const uint8_t *data, size_t len)
Write a labelled hex dump of a binary buffer at debug level.
void host_log(uint8_t level, const char *tag, const char *msg)
Write a single log line at the given level.
CDC Badge OS plugin host API - canonical C ABI contract.