On Tue, Mar 6, 2012 at 15:18, <hwri...@apache.org> wrote: >... > +++ subversion/trunk/subversion/tests/cmdline/svntest/main.py Tue Mar 6 > 20:18:16 2012 >... > @@ -78,6 +79,10 @@ SVN_VER_MINOR = 8 > > default_num_threads = 5 > > +# Set up logging > +logger = logging.getLogger(__name__)
You may as well use the default logger. That way, every module can just: import logging ; logging.info('whatever: %s %s', foo, bar) >... > @@ -1473,6 +1469,9 @@ def create_default_options(): > > def _create_parser(): > """Return a parser for our test suite.""" > + def set_log_debug(option, opt, value, parser): > + logger.setLevel(logging.DEBUG) axe this, see below: > + > # set up the parser > _default_http_library = 'serf' > usage = 'usage: %prog [options] [<test> ...]' > @@ -1481,7 +1480,8 @@ def _create_parser(): > help='Print test doc strings instead of running them') > parser.add_option('--milestone-filter', action='store', > dest='milestone_filter', > help='Limit --list to those with target milestone > specified') > - parser.add_option('-v', '--verbose', action='store_true', dest='verbose', > + parser.add_option('-v', '--verbose', action='callback', > + callback=set_log_debug, > help='Print binary command-lines (not with --quiet)') callback=logger.setLevel, callback_args=(logging.DEBUG,) >... You may want to change most of the calls to logging.FOO rather than logger.FOO for consistency with other modules that will use the logging framework. I would also recommend creating a Formatter and attaching it to that StreamHandler: formatter = logging.Formatter('%(asctime)s [%(levelname)s] %(message)s', '%Y-%m-%d %H:%M:%S') handler.setFormatter(formatter) that will give us a timestamp for each line. Cheers, -g