diff options
author | Christian Schwede <christian.schwede@enovance.com> | 2015-04-20 07:30:46 +0000 |
---|---|---|
committer | Christian Schwede <christian.schwede@enovance.com> | 2015-04-20 07:37:53 +0000 |
commit | ae51e6b26fcddc97e3787feccba69db29fa728aa (patch) | |
tree | ba4472ffa7bf9e04c6cd1fbc3b6553f60d453a7f | |
parent | 418ae6f13a6240d83e0ce305d15056792cb9e2e9 (diff) | |
download | swift-bench-ae51e6b26fcddc97e3787feccba69db29fa728aa.tar.gz |
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
-rwxr-xr-x | bin/swift-bench-client | 7 |
1 files changed, 5 insertions, 2 deletions
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({ |