19 #ifndef UUID_SYSLOG_H_
20 #define UUID_SYSLOG_H_
23 #ifdef ARDUINO_ARCH_ESP8266
24 # include <ESP8266WiFi.h>
37 #ifndef UUID_LOG_THREAD_SAFE
38 # define UUID_LOG_THREAD_SAFE 0
41 #ifndef UUID_COMMON_STD_MUTEX_AVAILABLE
42 # define UUID_COMMON_STD_MUTEX_AVAILABLE 0
45 #if defined(DOXYGEN) || UUID_COMMON_STD_MUTEX_AVAILABLE
46 # define UUID_SYSLOG_THREAD_SAFE 1
48 # define UUID_SYSLOG_THREAD_SAFE 0
51 #if UUID_LOG_THREAD_SAFE
70 #if UUID_COMMON_THREAD_SAFE && UUID_LOG_THREAD_SAFE && UUID_SYSLOG_THREAD_SAFE
219 void operator<<(std::shared_ptr<uuid::log::Message> message)
override;
240 QueuedLogMessage(
unsigned long id, std::shared_ptr<uuid::log::Message> &&content);
245 std::shared_ptr<const uuid::log::Message>
content_;
262 void add_message(std::shared_ptr<uuid::log::Message> &message);
300 #if UUID_SYSLOG_THREAD_SAFE
size_t current_log_messages() const
Get the current number of queued log messages.
Logger instance used to make log messages.
void remove_queued_messages(uuid::log::Level level)
Remove messages that were queued before the log level was set.
unsigned long log_message_id_
Log message that has been queued.
static constexpr size_t MAX_LOG_MESSAGES
Log handler for sending messages to a syslog server.
Level
Severity level of log messages.
std::string hostname() const
Get local hostname.
Logger handler used to process log messages.
static constexpr uint16_t DEFAULT_PORT
std::list< QueuedLogMessage > log_messages_
std::pair< IPAddress, uint16_t > destination() const
Get the server to send messages to.
void start()
Register the log handler with the logging framework.
void add_message(std::shared_ptr< uuid::log::Message > &message)
Add a new log message.
QueuedLogMessage(unsigned long id, std::shared_ptr< uuid::log::Message > &&content)
Create a queued log message.
static uuid::log::Logger logger_
bool transmit(const QueuedLogMessage &message)
Attempt to transmit one message to the server.
std::shared_ptr< const uuid::log::Message > content_
void operator<<(std::shared_ptr< uuid::log::Message > message) override
Add a new log message.
unsigned long mark_interval() const
Get mark interval.
uuid::log::Level log_level() const
Get the current log level.
size_t maximum_log_messages_
size_t maximum_log_messages() const
Get the maximum number of queued log messages.
bool can_transmit()
Check if it is possible to transmit to the server.
static constexpr bool thread_safe
Thread-safe status of the library.
SyslogService()=default
Create a new syslog service log handler.
void loop()
Dispatch queued log messages.