From fbf3b103e1a94be942905f0d16278baa7aef3fed Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Tue, 31 Aug 2010 13:13:21 +0000 Subject: Allow setting the verbosity level of bbstoreaccounts. --- bin/bbstoreaccounts/bbstoreaccounts.cpp | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/bin/bbstoreaccounts/bbstoreaccounts.cpp b/bin/bbstoreaccounts/bbstoreaccounts.cpp index 318f9725..9a54bd2a 100644 --- a/bin/bbstoreaccounts/bbstoreaccounts.cpp +++ b/bin/bbstoreaccounts/bbstoreaccounts.cpp @@ -538,10 +538,11 @@ int main(int argc, const char *argv[]) // Filename for configuration file? std::string configFilename = BOX_GET_DEFAULT_BBACKUPD_CONFIG_FILE; + int logLevel = Log::EVERYTHING; // See if there's another entry on the command line int c; - while((c = getopt(argc, (char * const *)argv, "c:m")) != -1) + while((c = getopt(argc, (char * const *)argv, "c:W:m")) != -1) { switch(c) { @@ -550,6 +551,15 @@ int main(int argc, const char *argv[]) configFilename = optarg; break; + case 'W': + logLevel = Logging::GetNamedLevel(optarg); + if(logLevel == Log::INVALID) + { + BOX_FATAL("Invalid logging level: " << optarg); + return 2; + } + break; + case 'm': // enable machine readable output sMachineReadableOutput = true; @@ -560,6 +570,10 @@ int main(int argc, const char *argv[]) PrintUsageAndExit(); } } + + Logging::FilterConsole((Log::Level) logLevel); + Logging::FilterSyslog (Log::NOTHING); + // Adjust arguments argc -= optind; argv += optind; -- cgit v1.2.3