]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
do not dynamically allocate entries. backend currently doesn't do anything other...
authorCharles-Henri Bruyand <charles-henri.bruyand@open-xchange.com>
Fri, 30 Apr 2021 14:30:49 +0000 (16:30 +0200)
committerCharles-Henri Bruyand <charles-henri.bruyand@open-xchange.com>
Fri, 30 Apr 2021 14:30:49 +0000 (16:30 +0200)
pdns/pdns_recursor.cc
pdns/recursordist/logging.cc
pdns/recursordist/logging.hh

index 87ec61824521c53b99346127f9abf60d90b856ea..4c8415fd5953cfa91daf6da8c382d36f5d69631f 100644 (file)
@@ -5394,24 +5394,24 @@ catch(...) {
 
 
 
-static void loggerBackend(std::unique_ptr<Logging::Entry> entry) {
+static void loggerBackend(const Logging::Entry& entry) {
   static thread_local std::stringstream buf;
 
   buf.str("");
-  buf << "msg=" << std::quoted(entry->message);
-  if (entry->error) {
-    buf << " oserror=" << std::quoted(entry->error.get());
+  buf << "msg=" << std::quoted(entry.message);
+  if (entry.error) {
+    buf << " oserror=" << std::quoted(entry.error.get());
   }
 
-  if (entry->name) {
-    buf << " subsystem=" << std::quoted(entry->name.get());
+  if (entry.name) {
+    buf << " subsystem=" << std::quoted(entry.name.get());
   }
 
-  for (auto const& v: entry->values) {
+  for (auto const& v: entry.values) {
     buf << " ";
     buf << v.first << "=" << std::quoted(v.second);
   }
-  g_log << Logger::Urgency(entry->level) << buf.str() << endl;
+  g_log << Logger::Urgency(entry.level) << buf.str() << endl;
 }
 
 
index 7a81bd5818be8e88a4a01a34575c7fb69c7c00a1..7b058c4bcc54c3c31bb5d2612f894e7665d8987a 100644 (file)
@@ -46,18 +46,18 @@ namespace Logging
     if (_level > _verbosity) {
       return ;
     }
-    auto entry = std::unique_ptr<Entry>(new Entry());
-    entry->level = _level;
-    entry->name = _name;
-    entry->message = msg;
-    entry->error = err;
+    Entry entry;
+    entry.level = _level;
+    entry.name = _name;
+    entry.message = msg;
+    entry.error = err;
     auto parent = _parent;
-    entry->values.insert(_values.begin(), _values.end());
+    entry.values.insert(_values.begin(), _values.end());
     while (parent) {
-      entry->values.insert(parent->_values.begin(), parent->_values.end());
+      entry.values.insert(parent->_values.begin(), parent->_values.end());
       parent = parent->_parent;
     }
-    _callback(std::move(entry));
+    _callback(entry);
   }
 
   void Logger::error(int err, const std::string& msg)
index 71c7aa781dcdecfa1a062e9842c05579225b9392..73b1d71ade8376f82be9f7b322a8ff874f304048 100644 (file)
@@ -64,7 +64,7 @@ namespace Logging {
 //  template <>
 //  Loggable<std::string>::Loggable(const std::string& v): _t(v) {}
 
-  typedef void(*EntryLogger)(std::unique_ptr<Entry>);
+  typedef void(*EntryLogger)(const Entry&);
 
   class Logger: public Logr::Logger, public std::enable_shared_from_this<Logger>
   {