11#ifndef SD_JOURNAL_SUPPRESS_LOCATION
12# define SD_JOURNAL_SUPPRESS_LOCATION
14#include <systemd/sd-journal.h>
24template<
typename Mutex>
52 size_t length = msg.
payload.size();
63 err = (sd_journal_send)(
"MESSAGE=%.*s",
static_cast<int>(length), msg.
payload.data(),
"PRIORITY=%d", syslog_level(msg.
level),
68 err = (sd_journal_send)(
"MESSAGE=%.*s",
static_cast<int>(length), msg.
payload.data(),
"PRIORITY=%d", syslog_level(msg.
level),
69 "SYSLOG_IDENTIFIER=%.*s",
static_cast<int>(msg.
logger_name.size()), msg.
logger_name.data(),
"CODE_FILE=%s",
81 return syslog_levels_.
at(
static_cast<levels_array::size_type
>(l));
92template<
typename Factory = spdlog::synchronous_factory>
95 return Factory::template create<sinks::systemd_sink_mt>(logger_name);
98template<
typename Factory = spdlog::synchronous_factory>
101 return Factory::template create<sinks::systemd_sink_st>(logger_name);
levels_array syslog_levels_
int syslog_level(level::level_enum l)
void sink_it_(const details::log_msg &msg) override
systemd_sink(const systemd_sink &)=delete
systemd_sink & operator=(const systemd_sink &)=delete
std::shared_ptr< logger > systemd_logger_mt(const std::string &logger_name)
std::shared_ptr< logger > systemd_logger_st(const std::string &logger_name)
SPDLOG_INLINE void throw_spdlog_ex(const std::string &msg, int last_errno)
string_view_t logger_name
SPDLOG_CONSTEXPR bool empty() const SPDLOG_NOEXCEPT