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
This commit is contained in:
parent
418ae6f13a
commit
ae51e6b26f
|
@ -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({
|
||||
|
|
Loading…
Reference in New Issue