From: Waylan L. <wa...@gm...> - 2008-10-06 18:35:40
|
Mike thanks for the bug report on Ticket 18 [1]. I'm copying the list with my response. > markdown.py has a hardcoded logging setting of DEBUG, > which allows all DEBUG messages to go out to all > configured handlers. There's then a comment which says > something to the effect of "this is restricted by handlers > later". I'd like to propose that this is the incorrect usage > of logging Actually, based on my testing the current behavior is correct. Suppose we set the logger to CRITICAL. Then, someone adds a handler (perhaps that writes to a log file) set to DEBUG. Because the logger only allows CRITICAL messages through, the handler would never receive anything less than CRITICAL even though its set to DEBUG. That's unacceptable - and why the logger is wide open and the handlers later restrict the level. The intention is that users would set (and/or remove) handlers and set the level for each handler as they need. In fact, we realize that the StreamHandler will break in some web server environments (it's indented for command line use) and may need to be removed/replaced with a handler appropriate for your system. That's why we recently adopted use of Python's logger rather than our own old inflexible home-grown solution. It's much easier to override handlers than monkeypatch the old system. > The workaround for now is that you have to hardcode a call > to "logging.getLogger("MARKDOWN").setLevel(logging.WARN)" > to silence the MARKDOWN logger in your application code Actually I envisioned something very similar, except altering the *handler* attached to the logger, not the logger itself. Perhaps it's not the most convenient (in that it doesn't integrate with your environment's settings file), but a solution that will work in a variety of different situations is certainly welcome. I'm not personally familiar with Pylons and/or Paste, but would certainly like to see easy use of markdown in such a context. At the same time, markdown needs to continue to work as it does now from the command line as well as in other environments. If anyone has any suggestions and/or solutions I'm all ears. [1]: http://www.freewisdom.org/projects/python-markdown/Tickets/000018 -- ---- Waylan Limberg wa...@gm... |