From ae51e6b26fcddc97e3787feccba69db29fa728aa Mon Sep 17 00:00:00 2001 From: Christian Schwede Date: Mon, 20 Apr 2015 07:30:46 +0000 Subject: Fix bug when using --log-level option Fixes a bug when using the --log-level/-o option. These are currently not usable, because a condition always exits if there are not exactly two command-line arguments used (the ip and port). This patch also ensures that the used log-level settings are valid choices. Change-Id: I5d64e57b59947c059924fce3e458cfe9fa284318 --- bin/swift-bench-client | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'bin') diff --git a/bin/swift-bench-client b/bin/swift-bench-client index 4a3d118..c5e251f 100755 --- a/bin/swift-bench-client +++ b/bin/swift-bench-client @@ -27,12 +27,15 @@ if __name__ == '__main__': parser = OptionParser(usage=usage) parser.add_option('-o', '--log-level', dest='log_level', default='info', + choices=[ + 'debug', 'info', 'warning', 'error', 'critical'], help='Logging level (debug, info, etc)') - if len(sys.argv) != 3: + options, args = parser.parse_args() + + if len(args) != 2: parser.print_help() sys.exit(1) - options, args = parser.parse_args() logger = logging.getLogger('swift-bench-client') logger.setLevel({ -- cgit v1.2.1