[PEAK] [setuptools] Logging

P.J. Eby pje at telecommunity.com
Thu Apr 15 16:14:28 EDT 2010


At 03:36 PM 4/15/2010 -0400, Nikolaus Rath wrote:
>On 04/15/2010 03:01 PM, P.J. Eby wrote:
> > At 02:54 PM 4/15/2010 -0400, Nikolaus Rath wrote:
> >> On 04/15/2010 02:30 PM, P.J. Eby wrote:
> >> > At 11:27 AM 4/15/2010 -0400, Nikolaus Rath wrote:
> >> >> Hello,
> >> >>
> >> >> I would like to be able to specify a log level when running my test
> >> >> suite. What is the best way to do this?
> >> >>
> >> >> I was thinking about either adding an additional '--log-level'
> >> option to
> >> >> the existing 'test' command or adding the option globally for the
> >> entire
> >> >> setup.py. But I didn't find any information about how to do any of
> >> these
> >> >> two.
> >> >
> >> > Have you tried -v and -q?  The test command already supports these, as
> >> > does the entire setup.py.
> >>
> >> No, I haven't. I want to initialize the "logging" module with its 5 or
> >> so logging levels, and these options just control the verbosity of
> >> setup.py und unittest, right?
> >
> > No.  Distutils has its own, independent logging system that is in no way
> > related, except for some superficial API similarities.  Likewise,
> > unittest (or at least the versions I'm familiar with) does not use the
> > logging module either.
>
>But that's exactly what I'm saying. I want to initialize the logging
>module, and the -q and -v options of setup.py do not help at all, since
>they only deal with distutil's and unittest's logging.
>
>Therefore I want to add a *new* option (either to setup.py or to the
>"test" command) that initializes the logging module. My question is: how
>do I do that?

Oh.  You'd have to subclass the test command for that, at least if 
you want access to command line parameters.  But if you just want 
some code to initialize the logging module to a standard setting, why 
not just define a test suite in a module that does the initialization 
when imported?



More information about the PEAK mailing list