diff options
Diffstat (limited to 'cpp/src/qpid/log')
| -rw-r--r-- | cpp/src/qpid/log/Logger.cpp | 5 | ||||
| -rw-r--r-- | cpp/src/qpid/log/Options.cpp | 21 | ||||
| -rw-r--r-- | cpp/src/qpid/log/Options.h | 8 |
3 files changed, 16 insertions, 18 deletions
diff --git a/cpp/src/qpid/log/Logger.cpp b/cpp/src/qpid/log/Logger.cpp index 065d4508c7..ceb3977106 100644 --- a/cpp/src/qpid/log/Logger.cpp +++ b/cpp/src/qpid/log/Logger.cpp @@ -188,8 +188,11 @@ void Logger::remove(Statement& s) { statements.erase(&s); } -void Logger::configure(const Options& o, const std::string& prog) +void Logger::configure(const Options& opts, const std::string& prog) { + Options o(opts); + if (o.trace) + o.selectors.push_back("trace+"); { ScopedLock l(lock); syslogName=prog; diff --git a/cpp/src/qpid/log/Options.cpp b/cpp/src/qpid/log/Options.cpp index 3e117663ff..b15630ebb2 100644 --- a/cpp/src/qpid/log/Options.cpp +++ b/cpp/src/qpid/log/Options.cpp @@ -18,36 +18,34 @@ #include "Options.h" #include "Statement.h" -#include "qpid/CommonOptions.h" +#include "qpid/Options.h" namespace qpid { namespace log { using namespace std; -Options::Options() : - time(true), level(true), thread(false), source(false), function(false) +Options::Options(const std::string& name) : qpid::Options(name), + time(true), level(true), thread(false), source(false), function(false), trace(false) { outputs.push_back("stderr"); selectors.push_back("error+"); -} -void Options::addTo(po::options_description& desc) { - using namespace po; ostringstream levels; levels << LevelTraits::name(Level(0)); for (int i = 1; i < LevelTraits::COUNT; ++i) levels << " " << LevelTraits::name(Level(i)); - desc.add_options() + addOptions() + ("trace,t", optValue(trace), "Enable full debug tracing." ) ("log.enable", optValue(selectors, "RULE"), - "You can specify this option mutliple times.\n" + ("You can specify this option mutliple times.\n" "RULE is of the form 'LEVEL[+][:COMPONENT]'" - "Levels are: trace, debug, info, notice, warning, error, critical." + "Levels are: "+levels.str()+"\n" "For example:\n" "\t'--log.enable warning+' " "enables all warning, error and critical messages.\n" "\t'--log.enable debug:framing' " - "enables debug messages from the framing component.") + "enables debug messages from the framing component.").c_str()) ("log.output", optValue(outputs, "FILE"), "File to receive log output, or one of these special values: " "'stderr', 'stdout', 'syslog'.") @@ -61,9 +59,6 @@ void Options::addTo(po::options_description& desc) { "Include thread ID in log messages") ("log.function", optValue(function,"yes|no"), "Include function signature in log messages"); - } - - }} // namespace qpid::log diff --git a/cpp/src/qpid/log/Options.h b/cpp/src/qpid/log/Options.h index 39261c9b5d..441c6e8a8d 100644 --- a/cpp/src/qpid/log/Options.h +++ b/cpp/src/qpid/log/Options.h @@ -18,20 +18,20 @@ * limitations under the License. * */ -#include "qpid/CommonOptions.h" +#include "qpid/Options.h" namespace qpid { namespace log { /** Logging options for config parser. */ -struct Options { - Options(); - void addTo(po::options_description&); +struct Options : public qpid::Options { + Options(const std::string& name="Logging options"); std::vector<std::string> selectors; std::vector<std::string> outputs; bool time, level, thread, source, function; + bool trace; }; |
