diff options
author | Bernard Normier <bernard@zeroc.com> | 2012-10-22 12:56:41 -0400 |
---|---|---|
committer | Bernard Normier <bernard@zeroc.com> | 2012-10-22 12:56:41 -0400 |
commit | f1b727794617cc064d3aabee1e981cd4dcd07051 (patch) | |
tree | d4c18e607ad7059de11c06dd096dd28ee1f508f6 /cpp/src/Ice/LoggerUtil.cpp | |
parent | Merge branch 'master' of ssh://git/home/git/ice (diff) | |
download | ice-f1b727794617cc064d3aabee1e981cd4dcd07051.tar.bz2 ice-f1b727794617cc064d3aabee1e981cd4dcd07051.tar.xz ice-f1b727794617cc064d3aabee1e981cd4dcd07051.zip |
Fixed ICE-4882:
Better logging in C++, especially with services. On compilers with
stack-trace printing support, the stack trace of most exceptions is
now logged.
Diffstat (limited to 'cpp/src/Ice/LoggerUtil.cpp')
-rw-r--r-- | cpp/src/Ice/LoggerUtil.cpp | 69 |
1 files changed, 7 insertions, 62 deletions
diff --git a/cpp/src/Ice/LoggerUtil.cpp b/cpp/src/Ice/LoggerUtil.cpp index ebf9ea5de11..635fa8abd8f 100644 --- a/cpp/src/Ice/LoggerUtil.cpp +++ b/cpp/src/Ice/LoggerUtil.cpp @@ -23,6 +23,12 @@ extern bool ICE_DECLSPEC_IMPORT printStackTraces; } +string +Ice::LoggerOutputBase::str() const +{ + return _str.str(); +} + ostringstream& Ice::LoggerOutputBase::__str() { @@ -52,68 +58,6 @@ Ice::operator<<(Ice::LoggerOutputBase& out, const std::exception& ex) return out; } -Ice::Print::Print(const LoggerPtr& logger) : - _logger(logger) -{ -} - -Ice::Print::~Print() -{ - flush(); -} - -void -Ice::Print::flush() -{ - string s = __str().str(); - if(!s.empty()) - { - _logger->print(s); - } - __str().str(""); -} - -Ice::Warning::Warning(const LoggerPtr& logger) : - _logger(logger) -{ -} - -Ice::Warning::~Warning() -{ - flush(); -} - -void -Ice::Warning::flush() -{ - string s = __str().str(); - if(!s.empty()) - { - _logger->warning(s); - } - __str().str(""); -} - -Ice::Error::Error(const LoggerPtr& logger) : - _logger(logger) -{ -} - -Ice::Error::~Error() -{ - flush(); -} - -void -Ice::Error::flush() -{ - string s = __str().str(); - if(!s.empty()) - { - _logger->error(s); - } - __str().str(""); -} Ice::Trace::Trace(const LoggerPtr& logger, const string& category) : _logger(logger), @@ -137,6 +81,7 @@ Ice::Trace::flush() __str().str(""); } + Ice::LoggerPlugin::LoggerPlugin(const CommunicatorPtr& communicator, const LoggerPtr& logger) { if(communicator == 0) |