~singpolyma/biboumi

b4b9828de50c09fea5503b3b3ead2ae9d5144404 — louiz’ 6 years ago 34d6c2b
Follow log_level even when using journald output

fix #3328
2 files changed, 13 insertions(+), 8 deletions(-)

M CHANGELOG.rst
M src/logger/logger.hpp
M CHANGELOG.rst => CHANGELOG.rst +2 -0
@@ 10,6 10,8 @@ Version 7.0
  would ignore our messages entirely.
- Fix the iq result sent at the end of a MAM response. Some clients (e.g.
  gajim) would throw an error as a result.
- log_level configuration option is no longer ignored if the logs are written
  into journald

Sqlite3 to PostgreSQL migration
-------------------------------

M src/logger/logger.hpp => src/logger/logger.hpp +11 -8
@@ 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
      {