]> granicus.if.org Git - pdns/commitdiff
Merge pull request #6689 from rgacogne/logger-thread-local-static
authorRemi Gacogne <rgacogne@users.noreply.github.com>
Thu, 10 Jan 2019 13:43:58 +0000 (14:43 +0100)
committerGitHub <noreply@github.com>
Thu, 10 Jan 2019 13:43:58 +0000 (14:43 +0100)
logger: Use a function-level static var for the logger object

1  2 
pdns/logger.cc
pdns/logger.hh

diff --cc pdns/logger.cc
index cd56e5d78d771b285d2bd60dcdaed828124e331f,852d486e9bc46e1faf9be266168dcfd65dedff50..dd890478b1efb536afa56e68b1be5f7a15f04219
@@@ -184,13 -173,71 +173,13 @@@ Logger& Logger::operator<<(const char *
    return *this;
  }
  
 -Logger& Logger::operator<<(int i)
 -{
 -  ostringstream tmp;
 -  tmp<<i;
 -
 -  *this<<tmp.str();
 -
 -  return *this;
 -}
 -
 -Logger& Logger::operator<<(double i)
 -{
 -  ostringstream tmp;
 -  tmp<<i;
 -  *this<<tmp.str();
 -  return *this;
 -}
 -
 -Logger& Logger::operator<<(unsigned int i)
 -{
 -  ostringstream tmp;
 -  tmp<<i;
 -
 -  *this<<tmp.str();
 -
 -  return *this;
 -}
 -
 -Logger& Logger::operator<<(unsigned long i)
 -{
 -  ostringstream tmp;
 -  tmp<<i;
 -
 -  *this<<tmp.str();
 -
 -  return *this;
 -}
 -
 -Logger& Logger::operator<<(unsigned long long i)
 -{
 -  ostringstream tmp;
 -  tmp<<i;
 -
 -  *this<<tmp.str();
 -
 -  return *this;
 -}
 -
 -Logger& Logger::operator<<(long i)
 -{
 -  ostringstream tmp;
 -  tmp<<i;
 -
 -  *this<<tmp.str();
 -
 -  return *this;
 -}
 -
  Logger& Logger::operator<<(ostream & (&)(ostream &))
  {
-   PerThread* pt =getPerThread();
+   PerThread& pt = getPerThread();
  
-   log(pt->d_output, pt->d_urgency);
-   pt->d_output.clear();
-   pt->d_urgency=Info;
+   log(pt.d_output, pt.d_urgency);
+   pt.d_output.clear();
+   pt.d_urgency=Info;
    return *this;
  }
  
diff --cc pdns/logger.hh
Simple merge