[Box Backup-commit] COMMIT r2726 - box/trunk/bin/bbstoreaccounts

subversion at boxbackup.org subversion at boxbackup.org
Tue Aug 31 14:13:21 BST 2010


Author: chris
Date: 2010-08-31 14:13:21 +0100 (Tue, 31 Aug 2010)
New Revision: 2726

Modified:
   box/trunk/bin/bbstoreaccounts/bbstoreaccounts.cpp
Log:
Allow setting the verbosity level of bbstoreaccounts.


Modified: box/trunk/bin/bbstoreaccounts/bbstoreaccounts.cpp
===================================================================
--- box/trunk/bin/bbstoreaccounts/bbstoreaccounts.cpp	2010-08-31 13:12:56 UTC (rev 2725)
+++ box/trunk/bin/bbstoreaccounts/bbstoreaccounts.cpp	2010-08-31 13:13:21 UTC (rev 2726)
@@ -538,10 +538,11 @@
 
 	// 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 @@
 			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 @@
 			PrintUsageAndExit();
 		}
 	}
+
+	Logging::FilterConsole((Log::Level) logLevel);
+	Logging::FilterSyslog (Log::NOTHING);
+
 	// Adjust arguments
 	argc -= optind;
 	argv += optind;




More information about the Boxbackup-commit mailing list