mirror of
https://github.com/python/cpython.git
synced 2025-08-02 08:02:56 +00:00
Improved logging.Formatter date/time formatting documentation.
This commit is contained in:
parent
33a299428d
commit
40d9a4e854
2 changed files with 13 additions and 1 deletions
|
@ -319,6 +319,14 @@ order::
|
||||||
|
|
||||||
"%(asctime)s - %(levelname)s - %(message)s"
|
"%(asctime)s - %(levelname)s - %(message)s"
|
||||||
|
|
||||||
|
Formatters use a user-configurable function to convert the creation time of a
|
||||||
|
record to a tuple. By default, :func:`time.localtime` is used; to change this
|
||||||
|
for a particular formatter instance, set the ``converter`` attribute of the
|
||||||
|
instance to a function with the same signature as :func:`time.localtime` or
|
||||||
|
:func:`time.gmtime`. To change it for all formatters, for example if you want
|
||||||
|
all logging times to be shown in GMT, set the ``converter`` attribute in the
|
||||||
|
Formatter class (to ``time.gmtime`` for GMT display).
|
||||||
|
|
||||||
|
|
||||||
Configuring Logging
|
Configuring Logging
|
||||||
^^^^^^^^^^^^^^^^^^^
|
^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
|
@ -433,7 +433,11 @@ class Formatter(object):
|
||||||
traceback.print_exception()
|
traceback.print_exception()
|
||||||
"""
|
"""
|
||||||
sio = io.StringIO()
|
sio = io.StringIO()
|
||||||
traceback.print_exception(ei[0], ei[1], ei[2], None, sio)
|
tb = ei[2]
|
||||||
|
# See issues #9427, #1553375. Commented out for now.
|
||||||
|
#if getattr(self, 'fullstack', False):
|
||||||
|
# traceback.print_stack(tb.tb_frame.f_back, file=sio)
|
||||||
|
traceback.print_exception(ei[0], ei[1], tb, None, sio)
|
||||||
s = sio.getvalue()
|
s = sio.getvalue()
|
||||||
sio.close()
|
sio.close()
|
||||||
if s[-1:] == "\n":
|
if s[-1:] == "\n":
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue