32 if ((
unsigned) level <= 7) {
37 size_t len = message_len;
39 if (this->
strip_ && message[0] == 0x1B &&
len > 11) {
47 size_t remaining =
sizeof(packet);
50 int ret = snprintf(packet, remaining,
"<%d>", pri);
51 if (ret <= 0 ||
static_cast<size_t>(ret) >= remaining) {
59 size_t ts_written = now.
is_valid() ? now.strftime(packet + offset, remaining,
"%b %e %H:%M:%S") : 0;
62 remaining -= ts_written;
63 }
else if (remaining > 0) {
64 packet[offset++] =
'-';
69 ret = snprintf(packet + offset, remaining,
" %s %s: %.*s",
App.
get_name().c_str(), tag, (
int)
len,
message);
72 offset += std::min(
static_cast<size_t>(ret), remaining > 0 ? remaining - 1 : 0);
const std::string & get_name() const
Get the name of this Application set by pre_setup().
udp::UDPComponent * parent_
void add_log_listener(LogListener *listener)
Register a log listener to receive log messages.
void on_log(uint8_t level, const char *tag, const char *message, size_t message_len) override
time::RealTimeClock * time_
void log_(int level, const char *tag, const char *message, size_t message_len) const
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 2018)