ESPHome 2026.11.0b6
Loading...
Searching...
No Matches
esphome_syslog.h
Go to the documentation of this file.
1#pragma once
4#include "esphome/core/log.h"
7
8#ifdef USE_NETWORK
9namespace esphome::syslog {
14
17size_t append_redacted_message(char *buf, size_t size, size_t pos, const char *message, size_t len);
18
19class Syslog final : public Component, public Parented<udp::UDPComponent> {
20 public:
21 Syslog(uint8_t level, time::RealTimeClock *time) : time_(time), log_level_(level) {}
22 void setup() override;
23 void on_log(uint8_t level, const char *tag, const char *message, size_t message_len);
24 void set_strip(bool strip) { this->strip_ = strip; }
25 void set_facility(uint8_t facility) { this->facility_ = facility; }
27
28 protected:
29 void log_(uint8_t level, const char *tag, const char *message, size_t message_len) const;
30
32 uint8_t log_level_;
33 uint8_t facility_{16};
34 bool strip_{true};
36};
37} // namespace esphome::syslog
38#endif
Helper class to easily give an object a parent of type T.
Definition helpers.h:2160
void log_(uint8_t level, const char *tag, const char *message, size_t message_len) const
time::RealTimeClock * time_
Syslog(uint8_t level, time::RealTimeClock *time)
void set_format(SyslogFormat format)
void set_facility(uint8_t facility)
void on_log(uint8_t level, const char *tag, const char *message, size_t message_len)
void set_strip(bool strip)
The RealTimeClock class exposes common timekeeping functions via the device's local real-time clock.
const LogString * message
Definition component.cpp:35
const char * format
size_t append_redacted_message(char *buf, size_t size, size_t pos, const char *message, size_t len)
Append len bytes of message to buf at pos, replacing every LOG_SECRET() region with "[redacted]".
const void size_t len
Definition hal.h:68
uint16_t size
Definition helpers.cpp:34
size_t size_t pos
Definition helpers.h:1333