Vinay Sajip added the comment:
I've added the ability to set handler properties via configuration slightly
more easily, see the code in changeset a81ae412174a (the unit test shows how
the configuration looks in practice). This enhancement cannot be added to
earlier Python versions (no feature
Changes by Andrew Svetlov andrew.svet...@gmail.com:
--
nosy: +asvetlov
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue16391
___
___
Nikolay Bryskin added the comment:
Great, thanks!
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue16391
___
___
Python-bugs-list mailing list
Changes by Vinay Sajip vinay_sa...@yahoo.co.uk:
--
resolution: - invalid
status: open - closed
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue16391
___
Nikolay Bryskin added the comment:
Vinay, why do you close this feature request? Proposed workaround is just a
workaround and even doesn't provide some functionality - for example, it seems
impossible to define a terminator using config file.
--
resolution: invalid -
status: closed -
Vinay Sajip added the comment:
Well, the config file format is older and fileConfig() does not cover as much
as dictConfig() does. (For example, filters). I don't propose to spend time
enhancing fileConfig(), now that dictConfig() is available. If you are forced
to use fileConfig(), you can
Nikolay Bryskin added the comment:
Actually, I'm using dictConfig to load config from json file. And yes, ext://
provides a way to load custom handler, but, as far as I see
(https://github.com/jonashaag/cpython/blob/master/Lib/logging/config.py#L379-404),
there is no possibility to specify
Vinay Sajip added the comment:
I don't understand what you mean. For example, defining
def my_handler(*args, **kwargs):
terminator = kwargs.pop('terminator', '!\n')
h = logging.StreamHandler(*args, **kwargs)
h.terminator = terminator
return h
you can use with a definition of
Vinay Sajip added the comment:
You can already do this with Python 3.2 (and hence with later Python 3.x):
import logging.config
def my_handler(*args, **kwargs):
h = logging.StreamHandler(*args, **kwargs)
h.terminator = '!\n'
return h
LOGGING = {
'version': 1,
'handlers': {
Vinay Sajip added the comment:
Note that you can also use the value
'ext://__main__.my_handler'
for key '()'.
--
assignee: - vinay.sajip
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue16391
Nikolay Bryskin added the comment:
Hello, Taras.
I've renamed the issue - StreamHandler should also have a terminator __init__
keyword argument.
This argument is mostly needed for automatic logging configuration using
logging.config.dictConfig or logging.config.fileConfig.
--
title:
11 matches
Mail list logo