[issue3726] Allow ', ' delimiters in logging.config.fileConfig()

2008-08-29 Thread Will Maier

New submission from Will Maier <[EMAIL PROTECTED]>:

Currently, logging.config.fileConfig() inconsistently handles lines like:

[handlers]
keys = spam, eggs

[formatters]
keys = foo, bar

It does, however, correctly handle the ', ' delimiter in the [loggers]
section. This is because the various _install_*() functions in
logging.config aren't consistent about whether (and when) or not they
strip whitespace when generating key names.

Though the stdlib documentation only includes examples in the [handlers]
and [formatters] section with ',' delimiters, it seems reasonable to
expect that logging.config.fileConfig() should handle ', '. The attached
test demonstrates the failure and suggests a solution.

Thanks!
whitespace

--
components: Library (Lib)
files: logging.diff
keywords: patch
messages: 72134
nosy: wcmaier
severity: normal
status: open
title: Allow ',' delimiters in logging.config.fileConfig()
type: behavior
versions: Python 2.6
Added file: http://bugs.python.org/file11304/logging.diff

___
Python tracker <[EMAIL PROTECTED]>
<http://bugs.python.org/issue3726>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue2473] logging.LogRecord should know how to handle dict-like args

2008-03-24 Thread Will Maier

New submission from Will Maier <[EMAIL PROTECTED]>:

In (at least) Python 2.5.2, logging.logRecord provides a very useful
facility to interpolate formatted strings. This feature expands an *args
sequence; if that sequence has only one element and that element is a
dictionary, LogRecord uses the dictionary to interpolate keyword
formatted strings. This is incredibly useful, but the LogRecord
__init__() method includes a rather arbitrary type-specific check that
prevents users from passing dict-like objects to the log methods:

logging.__init__.py:204..238
class LogRecord:
[...]
def __init__(self, name, level, pathname, lineno,
 msg, args, exc_info, func=None):
[...]
if args and (len(args) == 1) and args[0] and (type(args[0]) ==
types.DictType):
args = args[0]


This restriction prevents the user from passing eg a subclass of
UserDict.DictMixin. Now, __init__() clearly does need to do _some_
checking of args, but it would be nice if that checking accepted
dict-like objects. I haven't come up with a good way to do this myself
yet, but I figured I'd submit the request now.

Thanks!

--
components: Library (Lib)
messages: 64415
nosy: wcmaier
severity: normal
status: open
title: logging.LogRecord should know how to handle dict-like args
type: feature request
versions: Python 2.5

__
Tracker <[EMAIL PROTECTED]>
<http://bugs.python.org/issue2473>
__
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com