Added --debug option to sample client.

git-svn-id: https://tftpy.svn.sourceforge.net/svnroot/tftpy/trunk@36 63283fd4-ec1e-0410-9879-cb7f675518da
This commit is contained in:
msoulier 2006-12-09 21:42:02 +00:00
parent 204cce4fbb
commit aece5aaf2e

View file

@ -35,6 +35,12 @@ def main():
action='store',
dest='output',
help='output file (default: same as requested filename)')
parser.add_option('-d',
'--debug',
action='store_true',
dest='debug',
default=False,
help='upgrade logging from info to debug')
options, args = parser.parse_args()
if not options.host or not options.filename:
parser.print_help()
@ -51,7 +57,10 @@ def main():
self.progress += len(pkt.data)
self.out("Downloaded %d bytes" % self.progress)
tftpy.setLogLevel(logging.INFO)
if options.debug:
tftpy.setLogLevel(logging.DEBUG)
else:
tftpy.setLogLevel(logging.INFO)
progresshook = Progress(tftpy.logger.info).progresshook