Fix #1130
This commit is contained in:
parent
fbe6f945f3
commit
90dd56b839
@ -22,6 +22,15 @@ class syslog_sink : public base_sink<Mutex>
|
|||||||
public:
|
public:
|
||||||
syslog_sink(std::string ident, int syslog_option, int syslog_facility, bool enable_formatting)
|
syslog_sink(std::string ident, int syslog_option, int syslog_facility, bool enable_formatting)
|
||||||
: enable_formatting_{enable_formatting}
|
: enable_formatting_{enable_formatting}
|
||||||
|
, syslog_levels_{
|
||||||
|
/* spdlog::level::trace */ LOG_DEBUG,
|
||||||
|
/* spdlog::level::debug */ LOG_DEBUG,
|
||||||
|
/* spdlog::level::info */ LOG_INFO,
|
||||||
|
/* spdlog::level::warn */ LOG_WARNING,
|
||||||
|
/* spdlog::level::err */ LOG_ERR,
|
||||||
|
/* spdlog::level::critical */ LOG_CRIT,
|
||||||
|
/* spdlog::level::off */ LOG_INFO
|
||||||
|
}
|
||||||
, ident_{std::move(ident)}
|
, ident_{std::move(ident)}
|
||||||
{
|
{
|
||||||
// set ident to be program name if empty
|
// set ident to be program name if empty
|
||||||
@ -59,15 +68,7 @@ protected:
|
|||||||
bool enable_formatting_ = false;
|
bool enable_formatting_ = false;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::array<int, 7> syslog_levels_ {
|
std::array<int, 7> syslog_levels_;
|
||||||
/* level::trace */ LOG_DEBUG,
|
|
||||||
/* level::debug */ LOG_DEBUG,
|
|
||||||
/* level::info */ LOG_INFO,
|
|
||||||
/* level::warn */ LOG_WARNING,
|
|
||||||
/* level::err */ LOG_ERR,
|
|
||||||
/* level::critical */ LOG_CRIT,
|
|
||||||
/* level::off */ LOG_INFO
|
|
||||||
};
|
|
||||||
// must store the ident because the man says openlog might use the pointer as
|
// must store the ident because the man says openlog might use the pointer as
|
||||||
// is and not a string copy
|
// is and not a string copy
|
||||||
const std::string ident_;
|
const std::string ident_;
|
||||||
|
@ -23,7 +23,16 @@ class systemd_sink : public base_sink<Mutex>
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
//
|
//
|
||||||
explicit systemd_sink() {}
|
systemd_sink(): syslog_levels_{
|
||||||
|
/* spdlog::level::trace */ LOG_DEBUG,
|
||||||
|
/* spdlog::level::debug */ LOG_DEBUG,
|
||||||
|
/* spdlog::level::info */ LOG_INFO,
|
||||||
|
/* spdlog::level::warn */ LOG_WARNING,
|
||||||
|
/* spdlog::level::err */ LOG_ERR,
|
||||||
|
/* spdlog::level::critical */ LOG_CRIT,
|
||||||
|
/* spdlog::level::off */ LOG_INFO
|
||||||
|
}
|
||||||
|
{}
|
||||||
|
|
||||||
~systemd_sink() override {}
|
~systemd_sink() override {}
|
||||||
|
|
||||||
@ -32,15 +41,7 @@ public:
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
std::array<int, 7> syslog_levels_ {
|
std::array<int, 7> syslog_levels_;
|
||||||
/* level::trace */ LOG_DEBUG,
|
|
||||||
/* level::debug */ LOG_DEBUG,
|
|
||||||
/* level::info */ LOG_INFO,
|
|
||||||
/* level::warn */ LOG_WARNING,
|
|
||||||
/* level::err */ LOG_ERR,
|
|
||||||
/* level::critical */ LOG_CRIT,
|
|
||||||
/* level::off */ LOG_INFO
|
|
||||||
};
|
|
||||||
|
|
||||||
void sink_it_(const details::log_msg &msg) override
|
void sink_it_(const details::log_msg &msg) override
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user