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) {
53 offset = buf_append_printf(packet,
sizeof(packet), 0,
"<%d>", pri);
62 size_t timestamp_len = now.is_valid() ? now.strftime(
timestamp,
sizeof(
timestamp),
"%Y-%m-%dT%H:%M:%S%z") : 0;
63 if (timestamp_len == 24) {
69 offset = buf_append_printf(packet,
sizeof(packet), offset,
"%s",
timestamp);
73 offset = buf_append_printf(packet,
sizeof(packet), offset,
" %s %s - - - %.*s",
App.
get_name().
c_str(), tag,
78 offset += now.strftime(packet + offset,
sizeof(packet) - offset,
"%b %e %H:%M:%S ");
80 offset = buf_append_printf(packet,
sizeof(packet), offset,
"%s %s: %.*s",
App.
get_name().
c_str(), tag, (
int)
len,
84 if (offset >=
sizeof(packet)) {
85 offset =
sizeof(packet) - 1;
const StringRef & get_name() const
Get the name of this Application set by pre_setup().
udp::UDPComponent * parent_
constexpr const char * c_str() const
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)
const LogString * message
constexpr int LOG_LEVEL_TO_SYSLOG_SEVERITY[]
size_t buf_append_str(char *buf, size_t size, size_t pos, const char *str)
Safely append a string to buffer, returning new position (capped at size).
Application App
Global storage of Application pointer - only one Application can exist.