From: Waylan L. <wa...@gm...> - 2008-10-06 19:48:08
|
On Mon, Oct 6, 2008 at 3:02 PM, Michael Bayer <mi...@zz...> wrote: [snip] > its simple. markdown uses the "MARKDOWN" logger, and sends messages out > using whichever levels it likes; i.e. logger.info(), logger.debug(), etc. > But it does *not* within markdown.py's module initialization set the actual > log level or configure any handlers. This is because markdown.py in total > is not a commandline application, its first and foremost a library This is were things seem to fall apart. I agree here, however, whenever I've suggested changes of this type, I always get a response from Yuri that indicates he sees markdown first and foremost as a commandline script and second as a library. Perhaps we've gotten our wires crossed on this and that's not how he sees it - but I'm pretty sure he at least leans more in that direction that I do. Correct me if I'm wrong. > - it should not assume awareness about the environment in which it runs, and > especially not attempt to alter its runtime environment (which setting log > levels and configuring handlers is). logging was meant to be used in such > a way that you don't actually access elements of the module itself - the > getLogger() call and resulting object is the only interaction. > > If you have a specific function that assumes a certain application > environment and requires logging, that's fine - configure the handlers and > logging levels there. The specific settings of DEBUG and streamhandler are > appropriate in this case to when one uses the markdownFromFile function. > *That* is where the environment-specific logger should be configured, since > markdownFromFile assumes a particular environment; markdown.markdown() > should not. A global flag "loggingConfigured" may be used to detect that > markdownFromFile has already been called to prevent the same configuration > from being called twice. I like this suggestion. Although I'm not so sure the "loggingConfigured" flag is necessary. Thanks for your input. I'll play around with this and see what I can come up with. Unfortunately, I'm a little busy right now, so it may be a few weeks. -- ---- Waylan Limberg wa...@gm... |