diff options
| author | Alan Conway <aconway@apache.org> | 2008-09-25 14:16:51 +0000 |
|---|---|---|
| committer | Alan Conway <aconway@apache.org> | 2008-09-25 14:16:51 +0000 |
| commit | 928b806b8bc238de9222bd81e7fba950494588b7 (patch) | |
| tree | 699a4f1c38c0f2df8a3e41cb839b84f4b7ef5bcc /cpp/src/qpid | |
| parent | 8fca6bbadd52582a9d0e860a29adb0365c1fb71c (diff) | |
| download | qpid-python-928b806b8bc238de9222bd81e7fba950494588b7.tar.gz | |
Added ScopedSuppressLogging, used to suppress expected error messages in tests.
For examples see src/tests/exception_test.cpp
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@698981 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src/qpid')
| -rw-r--r-- | cpp/src/qpid/log/Logger.cpp | 2 | ||||
| -rw-r--r-- | cpp/src/qpid/log/Logger.h | 17 | ||||
| -rw-r--r-- | cpp/src/qpid/log/Options.cpp | 19 | ||||
| -rw-r--r-- | cpp/src/qpid/log/Options.h | 4 |
4 files changed, 32 insertions, 10 deletions
diff --git a/cpp/src/qpid/log/Logger.cpp b/cpp/src/qpid/log/Logger.cpp index 54df54bb94..b4f5bde186 100644 --- a/cpp/src/qpid/log/Logger.cpp +++ b/cpp/src/qpid/log/Logger.cpp @@ -17,7 +17,6 @@ */ #include "Logger.h" -#include "Options.h" #include "qpid/memory.h" #include "qpid/sys/Thread.h" #include <boost/pool/detail/singleton.hpp> @@ -212,6 +211,7 @@ void Logger::add(Statement& s) { } void Logger::configure(const Options& opts) { + options = opts; clear(); Options o(opts); if (o.trace) diff --git a/cpp/src/qpid/log/Logger.h b/cpp/src/qpid/log/Logger.h index fa38678bba..3201eac98f 100644 --- a/cpp/src/qpid/log/Logger.h +++ b/cpp/src/qpid/log/Logger.h @@ -1,5 +1,5 @@ -#ifndef LOGGER_H -#define LOGGER_H +#ifndef QPID_LOG_LOGGER_H +#define QPID_LOG_LOGGER_H /* * http://www.apache.org/licenses/LICENSE-2.0 @@ -13,6 +13,7 @@ */ #include "Selector.h" +#include "Options.h" #include "qpid/sys/Mutex.h" #include <boost/ptr_container/ptr_vector.hpp> #include <boost/noncopyable.hpp> @@ -21,8 +22,6 @@ namespace qpid { namespace log { -class Options; - /** * Central logging agent. * @@ -93,10 +92,13 @@ class Logger : private boost::noncopyable { /** Set a prefix for all messages */ void setPrefix(const std::string& prefix); - /** Reset the logger to it's original state. */ + /** Reset the logger. */ void clear(); - + /** Get the options used to configure the logger. */ + const Options& getOptions() const { return options; } + + private: typedef boost::ptr_vector<Output> Outputs; typedef std::set<Statement*> Statements; @@ -109,9 +111,10 @@ class Logger : private boost::noncopyable { Selector selector; int flags; std::string prefix; + Options options; }; }} // namespace qpid::log -#endif /*!LOGGER_H*/ +#endif /*!QPID_LOG_LOGGER_H*/ diff --git a/cpp/src/qpid/log/Options.cpp b/cpp/src/qpid/log/Options.cpp index e28f82648e..a850ea470d 100644 --- a/cpp/src/qpid/log/Options.cpp +++ b/cpp/src/qpid/log/Options.cpp @@ -146,6 +146,23 @@ Options::Options(const std::string& argv0, const std::string& name) : ("syslog-name", optValue(syslogName, "NAME"), "Name to use in syslog messages") ("syslog-facility", optValue(syslogFacility,"LOG_XXX"), "Facility to use in syslog messages") ; -} +} + +Options& Options::operator=(const Options& x) { + if (this != &x) { + selectors = x.selectors; + outputs = x.outputs; + time = x.time; + level= x.level; + thread = x.thread; + source = x.source; + function = x.function; + trace = x.trace; + syslogName = x.syslogName; + syslogFacility = x.syslogFacility; + prefix = x.prefix; + } + return *this; +} }} // namespace qpid::log diff --git a/cpp/src/qpid/log/Options.h b/cpp/src/qpid/log/Options.h index 13fca38f9d..3d128b5668 100644 --- a/cpp/src/qpid/log/Options.h +++ b/cpp/src/qpid/log/Options.h @@ -36,9 +36,11 @@ std::istream& operator>>(std::istream&, SyslogFacility&); /** Logging options for config parser. */ struct Options : public qpid::Options { /** Pass argv[0] for use in syslog output */ - Options(const std::string& argv0, + Options(const std::string& argv0=std::string(), const std::string& name="Logging options"); + Options& operator=(const Options&); + std::vector<std::string> selectors; std::vector<std::string> outputs; bool time, level, thread, source, function; |
