|
|
|
@ -19,9 +19,9 @@ class syslog_sink : public base_sink<Mutex>
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
syslog_sink(std::string ident, int syslog_option, int syslog_facility, bool enable_formatting):
|
|
|
|
|
enable_formatting_{enable_formatting},
|
|
|
|
|
ident_{std::move(ident)}
|
|
|
|
|
syslog_sink(std::string ident, int syslog_option, int syslog_facility, bool enable_formatting)
|
|
|
|
|
: enable_formatting_{enable_formatting}
|
|
|
|
|
, ident_{std::move(ident)}
|
|
|
|
|
{
|
|
|
|
|
priorities_[static_cast<size_t>(level::trace)] = LOG_DEBUG;
|
|
|
|
|
priorities_[static_cast<size_t>(level::debug)] = LOG_DEBUG;
|
|
|
|
@ -48,7 +48,7 @@ protected:
|
|
|
|
|
{
|
|
|
|
|
string_view_t payload;
|
|
|
|
|
|
|
|
|
|
if(enable_formatting_)
|
|
|
|
|
if (enable_formatting_)
|
|
|
|
|
{
|
|
|
|
|
fmt::memory_buffer formatted;
|
|
|
|
|
sink::formatter_->format(msg, formatted);
|
|
|
|
@ -86,23 +86,15 @@ using syslog_sink_st = syslog_sink<details::null_mutex>;
|
|
|
|
|
|
|
|
|
|
// Create and register a syslog logger
|
|
|
|
|
template<typename Factory = default_factory>
|
|
|
|
|
inline 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)
|
|
|
|
|
inline 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)
|
|
|
|
|
{
|
|
|
|
|
return Factory::template create<sinks::syslog_sink_mt>(logger_name, syslog_ident, syslog_option, syslog_facility, enable_formatting);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
template<typename Factory = default_factory>
|
|
|
|
|
inline 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)
|
|
|
|
|
inline 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)
|
|
|
|
|
{
|
|
|
|
|
return Factory::template create<sinks::syslog_sink_st>(logger_name, syslog_ident, syslog_option, syslog_facility, enable_formatting);
|
|
|
|
|
}
|
|
|
|
|