23 this, [](
void *self, uint8_t level,
const char *tag,
const char *
message,
size_t message_len) {
37 if ((
unsigned) level <= 7) {
42 size_t len = message_len;
44 if (this->
strip_ && message[0] == 0x1B &&
len > 11) {
52 size_t remaining =
sizeof(packet);
55 offset = buf_append_printf(packet,
sizeof(packet), 0,
"<%d>", pri);
63 size_t ts_written = now.
is_valid() ? now.strftime(packet + offset, remaining,
"%b %e %H:%M:%S") : 0;
66 }
else if (remaining > 0) {
67 packet[offset++] =
'-';
71 offset = buf_append_printf(packet,
sizeof(packet), offset,
" %s %s: %.*s",
App.
get_name().c_str(), tag, (
int)
len,
74 if (offset >=
sizeof(packet)) {
75 offset =
sizeof(packet) - 1;
const std::string & get_name() const
Get the name of this Application set by pre_setup().
udp::UDPComponent * parent_
void add_log_callback(void *instance, void(*fn)(void *, uint8_t, const char *, const char *, size_t))
Register a log callback to receive log messages.
time::RealTimeClock * time_
void log_(int level, const char *tag, const char *message, size_t message_len) const
void on_log(uint8_t level, const char *tag, const char *message, size_t message_len)
ESPTime now()
Get the time in the currently defined timezone.
void send_packet(const uint8_t *data, size_t size)
constexpr int LOG_LEVEL_TO_SYSLOG_SEVERITY[]
Application App
Global storage of Application pointer - only one Application can exist.
bool is_valid() const
Check if this ESPTime is valid (all fields in range and year is greater than or equal to 2019)