]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
dnsdist: Reuse the temporary logging string for syslog 11531/head
authorRemi Gacogne <remi.gacogne@powerdns.com>
Tue, 12 Apr 2022 13:41:48 +0000 (15:41 +0200)
committerRemi Gacogne <remi.gacogne@powerdns.com>
Wed, 13 Apr 2022 14:37:25 +0000 (16:37 +0200)
pdns/dolog.hh

index 3c5237a5bd20396ad5354aeb4f683b4f6fd49c3e..638db32aa9ea2a8344596c52331007fdfed0c8b6 100644 (file)
@@ -93,8 +93,11 @@ void genlog(int level, const char* s, Args... args)
   std::ostringstream str;
   dolog(str, s, args...);
 
-  if(g_syslog)
-    syslog(level, "%s", str.str().c_str());
+  auto output = str.str();
+
+  if (g_syslog) {
+    syslog(level, "%s", output.c_str());
+  }
 
 #ifdef DNSDIST
   if (g_logtimestamps) {
@@ -110,7 +113,7 @@ void genlog(int level, const char* s, Args... args)
   }
 #endif
 
-  std::cout<<str.str()<<std::endl;
+  std::cout<<output<<std::endl;
 }