Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
d0557bfe
Commit
d0557bfe
authored
Oct 25, 2010
by
Vinay Sajip
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
logging: Formatter implementation tweak.
parent
a39c5710
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
8 deletions
+12
-8
Lib/logging/__init__.py
Lib/logging/__init__.py
+12
-8
No files found.
Lib/logging/__init__.py
View file @
d0557bfe
...
@@ -482,6 +482,17 @@ class Formatter(object):
...
@@ -482,6 +482,17 @@ class Formatter(object):
self
.
_fmt
.
find
(
"${asctime}"
)
>=
0
self
.
_fmt
.
find
(
"${asctime}"
)
>=
0
return
result
return
result
def
formatMessage
(
self
,
record
):
style
=
self
.
_style
if
style
==
'%'
:
s
=
self
.
_fmt
%
record
.
__dict__
elif
style
==
'{'
:
s
=
self
.
_fmt
.
format
(
**
record
.
__dict__
)
else
:
from
string
import
Template
s
=
Template
(
self
.
_fmt
).
substitute
(
**
record
.
__dict__
)
return
s
def
format
(
self
,
record
):
def
format
(
self
,
record
):
"""
"""
Format the specified record as text.
Format the specified record as text.
...
@@ -498,14 +509,7 @@ class Formatter(object):
...
@@ -498,14 +509,7 @@ class Formatter(object):
record
.
message
=
record
.
getMessage
()
record
.
message
=
record
.
getMessage
()
if
self
.
usesTime
():
if
self
.
usesTime
():
record
.
asctime
=
self
.
formatTime
(
record
,
self
.
datefmt
)
record
.
asctime
=
self
.
formatTime
(
record
,
self
.
datefmt
)
style
=
self
.
_style
s
=
self
.
formatMessage
(
record
)
if
style
==
'%'
:
s
=
self
.
_fmt
%
record
.
__dict__
elif
style
==
'{'
:
s
=
self
.
_fmt
.
format
(
**
record
.
__dict__
)
else
:
from
string
import
Template
s
=
Template
(
self
.
_fmt
).
substitute
(
**
record
.
__dict__
)
if
record
.
exc_info
:
if
record
.
exc_info
:
# Cache the traceback text to avoid converting it multiple times
# Cache the traceback text to avoid converting it multiple times
# (it's constant anyway)
# (it's constant anyway)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment