diff options
author | Leah Klearman <lklrmn@gmail.com> | 2013-10-15 09:46:46 -0700 |
---|---|---|
committer | Leah Klearman <lklrmn@gmail.com> | 2013-10-17 16:05:36 -0700 |
commit | b682935055fccbbbad988e75679dfc01b0869622 (patch) | |
tree | 11032fcf3f16315286f539e83032254335b2681a /bin/swift | |
parent | e08ec3ab8a28facc95977fc25c7e1e5381507591 (diff) | |
download | python-swiftclient-b682935055fccbbbad988e75679dfc01b0869622.tar.gz |
enhance swiftclient logging
* log to debug for successes and info for errors
* remove dead code, neither body or raw_body are sent in kwargs
* include resp.reason and response headers in logging
* remove trailing \n in logging. users who want them can set logging.basicConfig(format=FORMAT)
* add --info option to swift cli
Change-Id: If07af46cb377f3f3d70f6c4284037241d360a8b7
Diffstat (limited to 'bin/swift')
-rwxr-xr-x | bin/swift | 16 |
1 files changed, 11 insertions, 5 deletions
@@ -1266,7 +1266,7 @@ if __name__ == '__main__': parser = OptionParser(version='%%prog %s' % version, usage=''' usage: %%prog [--version] [--help] [--snet] [--verbose] - [--debug] [--quiet] [--auth <auth_url>] + [--debug] [--info] [--quiet] [--auth <auth_url>] [--auth-version <auth_version>] [--user <username>] [--key <api_key>] [--retries <num_retries>] [--os-username <auth-user-name>] [--os-password <auth-password>] @@ -1311,8 +1311,11 @@ Examples: parser.add_option('-v', '--verbose', action='count', dest='verbose', default=1, help='Print more info') parser.add_option('--debug', action='store_true', dest='debug', - default=False, help='Show the curl commands of all http ' - 'queries.') + default=False, help='Show the curl commands and results ' + 'of all http queries regardless of result status.') + parser.add_option('--info', action='store_true', dest='info', + default=False, help='Show the curl commands and results ' + ' of all http queries which return an error.') parser.add_option('-q', '--quiet', action='store_const', dest='verbose', const=0, default=1, help='Suppress status output') parser.add_option('-A', '--auth', dest='auth', @@ -1434,9 +1437,12 @@ Examples: signal.signal(signal.SIGINT, immediate_exit) - if options.debug: + if options.debug or options.info: logger = logging.getLogger("swiftclient") - logging.basicConfig(level=logging.DEBUG) + if options.debug: + logging.basicConfig(level=logging.DEBUG) + elif options.info: + logging.basicConfig(level=logging.INFO) had_error = False |