19template<
typename Mutex>
33 , ident_{std::move(ident)}
36 ::openlog(ident_.empty() ?
nullptr : ident_.c_str(), syslog_option, syslog_facility);
52 if (enable_formatting_)
62 size_t length = payload.size();
69 ::syslog(syslog_prio_from_level(msg),
"%.*s",
static_cast<int>(length), payload.data());
73 bool enable_formatting_ =
false;
87 return syslog_levels_.
at(
static_cast<levels_array::size_type
>(msg.
level));
96template<
typename Factory = spdlog::synchronous_factory>
98 int syslog_facility = LOG_USER,
bool enable_formatting =
false)
100 return Factory::template create<sinks::syslog_sink_mt>(logger_name, syslog_ident, syslog_option, syslog_facility, enable_formatting);
103template<
typename Factory = spdlog::synchronous_factory>
105 int syslog_facility = LOG_USER,
bool enable_formatting =
false)
107 return Factory::template create<sinks::syslog_sink_st>(logger_name, syslog_ident, syslog_option, syslog_facility, enable_formatting);
int syslog_prio_from_level(const details::log_msg &msg) const
void sink_it_(const details::log_msg &msg) override
syslog_sink(std::string ident, int syslog_option, int syslog_facility, bool enable_formatting)
syslog_sink(const syslog_sink &)=delete
levels_array syslog_levels_
syslog_sink & operator=(const syslog_sink &)=delete
std::shared_ptr< logger > syslog_logger_st(const std::string &logger_name, const std::string &syslog_ident="", int syslog_option=0, int syslog_facility=LOG_USER, bool enable_formatting=false)
std::shared_ptr< logger > syslog_logger_mt(const std::string &logger_name, const std::string &syslog_ident="", int syslog_option=0, int syslog_facility=LOG_USER, bool enable_formatting=false)
fmt::basic_string_view< char > string_view_t
fmt::basic_memory_buffer< char, 250 > memory_buf_t