]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
Remove logging interfaces which lack a priority.
authorMiod Vallat <miod.vallat@powerdns.com>
Fri, 6 Mar 2026 10:05:30 +0000 (11:05 +0100)
committerMiod Vallat <miod.vallat@powerdns.com>
Fri, 6 Mar 2026 11:46:49 +0000 (12:46 +0100)
Signed-off-by: Miod Vallat <miod.vallat@powerdns.com>
pdns/logging.cc
pdns/logging.hh
pdns/logr.hh

index 9567f4d55fecd4e9e75c753a3d3656fc425e9196..0df265fdbf44e0451c50e9d824661377cbc6c971 100644 (file)
@@ -37,21 +37,11 @@ bool Logger::enabled(Logr::Priority prio) const
   return _level <= _verbosity || prio != Logr::Absent;
 }
 
-void Logger::info(const std::string& msg) const
-{
-  logMessage(msg, Logr::Absent, std::nullopt);
-}
-
 void Logger::info(Logr::Priority prio, const std::string& msg) const
 {
   logMessage(msg, prio, std::nullopt);
 }
 
-void Logger::logMessage(const std::string& msg, const std::optional<std::string>& err) const
-{
-  logMessage(msg, Logr::Absent, err);
-}
-
 void Logger::logMessage(const std::string& msg, Logr::Priority prio, const std::optional<std::string>& err) const
 {
   if (!enabled(prio)) {
@@ -83,16 +73,6 @@ void Logger::error(Logr::Priority prio, const std::string& err, const std::strin
   logMessage(msg, prio, err);
 }
 
-void Logger::error(int err, const std::string& msg) const
-{
-  logMessage(msg, Logr::Absent, std::string(stringerror(err)));
-}
-
-void Logger::error(const std::string& err, const std::string& msg) const
-{
-  logMessage(msg, Logr::Absent, err);
-}
-
 std::shared_ptr<Logr::Logger> Logger::v(size_t level) const
 {
   auto res = std::make_shared<Logger>(getptr(), _name, getVerbosity(), level + _level, _callback);
index ff9a01ef8e7ecda85790e1d82bea71e800f82603..fb64874db50e271965e4f3f8d6078e88647ba660 100644 (file)
@@ -182,10 +182,7 @@ class Logger : public Logr::Logger, public std::enable_shared_from_this<const Lo
 public:
   bool enabled(Logr::Priority) const override;
 
-  void info(const std::string& msg) const override;
   void info(Logr::Priority, const std::string& msg) const override;
-  void error(int err, const std::string& msg) const override;
-  void error(const std::string& err, const std::string& msg) const override;
   void error(Logr::Priority, int err, const std::string& msg) const override;
   void error(Logr::Priority, const std::string& err, const std::string& msg) const override;
 
@@ -205,7 +202,6 @@ public:
   void setVerbosity(size_t verbosity);
 
 private:
-  void logMessage(const std::string& msg, const std::optional<std::string>& err) const;
   void logMessage(const std::string& msg, Logr::Priority prio, const std::optional<std::string>& err) const;
   std::shared_ptr<const Logger> getptr() const;
 
@@ -233,7 +229,7 @@ constexpr bool g_slogStructured = true;
 // A typical use:
 //
 // SLOG(g_log<<Logger::Warning<<"Unable to parse configuration file '"<<configname<<"'"<<endl,
-//      startupLog->error("No such file", "Unable to parse configuration file", "config_file", Logging::Loggable(configname));
+//      startupLog->error(Logr::Warning, "No such file", "Unable to parse configuration file", "config_file", Logging::Loggable(configname));
 //
 // NOLINTNEXTLINE(cppcoreguidelines-macro-usage)
 #define SLOG(oldStyle, slogCall) \
index dc09201906f6f2fa420c90de6f743063fc5c7768..700c666bb085cd6711a54dc2dee691927384db14 100644 (file)
@@ -94,16 +94,8 @@ public:
   // the log line.  The key/value pairs can then be used to add additional
   // variable information.  The key/value pairs should alternate string
   // keys and arbitrary values.
-  virtual void info(const std::string& msg) const = 0;
   virtual void info(Logr::Priority, const std::string& msg) const = 0;
 
-  template <typename... Args>
-  void info(const std::string& msg, const std::string& key, const Loggable& value, const Args&... args) const
-  {
-    auto logger = this->withValues(key, value, args...);
-    logger->info(msg);
-  }
-
   template <typename... Args>
   void info(Priority prio, const std::string& msg, const std::string& key, const Loggable& value, const Args&... args) const
   {
@@ -119,25 +111,9 @@ public:
   // The msg field should be used to add context to any underlying error,
   // while the err field should be used to attach the actual error that
   // triggered this log line, if present.
-  virtual void error(const std::string& err, const std::string& msg) const = 0;
-  virtual void error(int err, const std::string& msg) const = 0;
   virtual void error(Logr::Priority, const std::string& err, const std::string& msg) const = 0;
   virtual void error(Logr::Priority, int err, const std::string& msg) const = 0;
 
-  template <typename... Args>
-  void error(const std::string& err, const std::string& msg, const std::string& key, const Loggable& value, const Args&... args) const
-  {
-    auto logger = this->withValues(key, value, args...);
-    logger->error(Logr::Absent, err, msg);
-  }
-
-  template <typename... Args>
-  void error(int err, const std::string& msg, const std::string& key, const Loggable& value, const Args&... args) const
-  {
-    auto logger = this->withValues(key, value, args...);
-    logger->error(Logr::Absent, err, msg);
-  }
-
   template <typename... Args>
   void error(Priority prio, const std::string& err, const std::string& msg, const std::string& key, const Loggable& value, const Args&... args) const
   {