25 template<
typename Mutex>
30 explicit syslog_sink(std::string ident =
"",
int syslog_option = 0,
int syslog_facility = LOG_USER)
31 : ident_(
std::move(ident))
33 priorities_[
static_cast<size_t>(
level::trace)] = LOG_DEBUG;
34 priorities_[
static_cast<size_t>(
level::debug)] = LOG_DEBUG;
35 priorities_[
static_cast<size_t>(
level::info)] = LOG_INFO;
36 priorities_[
static_cast<size_t>(
level::warn)] = LOG_WARNING;
37 priorities_[
static_cast<size_t>(
level::err)] = LOG_ERR;
39 priorities_[
static_cast<size_t>(
level::off)] = LOG_INFO;
42 ::openlog(ident_.empty() ?
nullptr : ident_.c_str(), syslog_option, syslog_facility);
62 std::array<int, 7> priorities_;
65 const std::string ident_;
72 return priorities_[
static_cast<size_t>(msg.
level)];
81 template<
typename Factory = default_factory>
83 const std::string &logger_name,
const std::string &syslog_ident =
"",
int syslog_option = 0,
int syslog_facility = (1 << 3))
85 return Factory::template create<sinks::syslog_sink_mt>(logger_name, syslog_ident, syslog_option, syslog_facility);
88 template<
typename Factory = default_factory>
90 const std::string &logger_name,
const std::string &syslog_ident =
"",
int syslog_option = 0,
int syslog_facility = (1 << 3))
92 return Factory::template create<sinks::syslog_sink_st>(logger_name, syslog_ident, syslog_option, syslog_facility);
syslog_sink & operator=(const syslog_sink &)=delete
void sink_it_(const details::log_msg &msg) override
std::shared_ptr< logger > syslog_logger_st(const std::string &logger_name, const std::string &syslog_ident="", int syslog_option=0, int syslog_facility=(1<< 3))
std::shared_ptr< logger > syslog_logger_mt(const std::string &logger_name, const std::string &syslog_ident="", int syslog_option=0, int syslog_facility=(1<< 3))
const string_view_t payload
std::string to_string(const T &value)
syslog_sink(std::string ident="", int syslog_option=0, int syslog_facility=LOG_USER)