def debug(m):
if opts.debug > 0:
- print m
+ print >>opts.debug_file, m
def format_time_interval(ti):
if ti < 120: return '%d:%02d' % (ti / 60, ti % 60)
if self._lbuf.endswith('\n'):
self.chatline(self._lbuf.rstrip())
self._lbuf = ''
+ if opts.debug >= 2:
+ debug(self.__str__())
if progress: progress.caughtup()
def changed(self):
progress.show_init(pirate, fetcher.ocean)
track = ChatLogTracker(myself, logfn)
- opts.debug -= 1
+ opts.debug -= 2
track.catchup(progress)
- opts.debug += 1
+ opts.debug += 2
track.force_redisplay()
help='cache yoweb pages in DIR')
ao('-D','--debug', action='count', dest='debug', default=0,
help='enable debugging output')
- ao('--debug-fd', action='count', dest='debug_fd',
+ ao('--debug-fd', type='int', dest='debug_fd',
help='write any debugging output to specified fd')
ao('-q','--quiet', action='store_true', dest='quiet',
help='suppress warning output')
pa.error('need a mode argument')
if opts.debug_fd is not None:
- opts.debug_file = fdopen(opts.debug_fd, 'w')
+ opts.debug_file = os.fdopen(opts.debug_fd, 'w')
+ else:
+ opts.debug_file = sys.stdout
mode = args[0]
mode_fn_name = 'do_' + mode.replace('_','#').replace('-','_')