Follow log_level even when using journald output

fix #3328
This commit is contained in:
louiz’
2018-01-12 20:08:15 +01:00
parent 34d6c2bce1
commit b4b9828de5
2 changed files with 13 additions and 8 deletions
+11 -8
View File
@@ -74,8 +74,8 @@ public:
bool use_systemd{false};
#endif
private:
const int log_level;
private:
std::ofstream ofstream{};
std::ostream stream;
@@ -105,13 +105,16 @@ namespace logging_details
if (Logger::instance()->use_systemd)
{
(void)level;
std::ostringstream os;
log(os, std::forward<U>(args)...);
sd_journal_send("MESSAGE=%s", os.str().data(),
"PRIORITY=%i", syslog_level,
"CODE_FILE=%s", src_file,
"CODE_LINE=%i", line,
nullptr);
if (level >= Logger::instance()->log_level)
{
std::ostringstream os;
log(os, std::forward<U>(args)...);
sd_journal_send("MESSAGE=%s", os.str().data(),
"PRIORITY=%i", syslog_level,
"CODE_FILE=%s", src_file,
"CODE_LINE=%i", line,
nullptr);
}
}
else
{