On Sep 29, 2:25 pm, Ivan Sagalaev <man...@softwaremaniacs.org> wrote:
> LOGGING = {
>      'errors': {
>          'handler': 'django.logging.FileLogger', # WatchedFileLogger copy
>          'filename': '...',
>          'level': 'debug',
>      },
>      'maintenance': {
>          'handler': 'logging.handlers.HTTPHandler',
>          'host': '...',
>          'url': '....',
>          'format': '....'
>      },
>
> }
>

On one of my projects, I had a YAML configuration which I loaded into
a dict using PyYAML, then configured logging from that. I propose to
generalise that solution to add a new function to logging.config
called dictConfig() which takes a dict as an argument and uses that to
configure logging. In practice the dict can of course come from a
literal in the code (your example), or a JSON or YAML string.

The important thing is to get the dict schema right and to make it
easy to generalise for user-defined handlers etc. So I will be posting
a proposal on python-dev to get comments and suggestions, and
providing a standalone implementation so that people have something
specific to comment on. Following a period for feedback (and assuming
the python devs don't shoot the idea down in flames), I propose to
actually implement this functionality in Python logging itself,
perhaps in 2.7/3.2.

However, to make it easy to use in Django and other systems which have
to work with older versions of Python, the functionality will be in
the form of a class (working title: DictConfigurator) which can just
be copied into Django (as has been suggested for other bits of
logging, such as WatchedFileHandler and NullHandler.

Comments welcome.

Regards,

Vinay Sajip
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To post to this group, send email to django-developers@googlegroups.com
To unsubscribe from this group, send email to 
django-developers+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to