[py-dev] Adding logdebug option to defaultconftest.py
Grig Gheorghiu
grig at gheorghiu.net
Wed Jun 15 00:56:15 CEST 2005
--- holger krekel <hpk at trillke.net> wrote:
> On Tue, Jun 14, 2005 at 15:12 -0700, Grig Gheorghiu wrote:
> > On second thoughts, it makes more sense for the logging level to be
> set
> > per logger, so maybe we should make it a parameter of set_logger.
> > Something like:
> >
> > py.log.set_logger('default', StdoutLogger(), logging_level='debug')
> >
> > We could also have a 'global' logging level if we wanted to, but
> the
> > standard logging module deals with log levels at the logger level
> > anyway.
>
> For the time being, i'd like to avoid bringing logging module
> details to py.log. I am starting to think about using
> py.log here and there and it seems like i am actually going
> for something like:
>
> class Something:
> log = py.log.Producer('something')
>
> def method(self):
> ...
> self.log.adhoccategory("processing", x)
>
> this shows by default on stdout unless you set a catch-all
> consumer or a specific one for e.g. 'something'.
>
> the "debugging" aspect then becomes a matter of defining
> which logging information i care for (which could be changed
> interactively or per command line switches as you suggested)
> Do that make sense to you?
Yes, it makes sense to me. I guess I was thinking more in terms of
'consumers' (which interface more heavily with the logging module),
whereas you're approaching it in terms of 'agnostic' producers. So I
think you're right, it doesn't make sense to burden the set_logger
function with yet another parameter.
Maybe the logging level should only be a parameter to the specific
loggers defined in consumer.py: File, Stdout, Stderr, Email, etc. Right
now it's arbitrarily set to logging.DEBUG.
Grig
More information about the py-dev
mailing list