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
2a20dfc2
Commit
2a20dfc2
authored
Oct 20, 2010
by
Vinay Sajip
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
logging: Made StreamHandler terminator configurable.
parent
f3500e11
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
3 deletions
+7
-3
Lib/logging/__init__.py
Lib/logging/__init__.py
+5
-3
Misc/NEWS
Misc/NEWS
+2
-0
No files found.
Lib/logging/__init__.py
View file @
2a20dfc2
...
...
@@ -359,7 +359,7 @@ class Formatter(object):
responsible for converting a LogRecord to (usually) a string which can
be interpreted by either a human or an external system. The base Formatter
allows a formatting string to be specified. If none is supplied, the
default value of "%s(message)
\
\
n
" is used.
default value of "%s(message)" is used.
The Formatter can be initialized with a format string which makes use of
knowledge of the LogRecord attributes - e.g. the default value mentioned
...
...
@@ -823,6 +823,8 @@ class StreamHandler(Handler):
sys.stdout or sys.stderr may be used.
"""
terminator
=
'
\
n
'
def
__init__
(
self
,
stream
=
None
):
"""
Initialize the handler.
...
...
@@ -855,8 +857,8 @@ class StreamHandler(Handler):
try
:
msg
=
self
.
format
(
record
)
stream
=
self
.
stream
fs
=
"%s
\
n
"
stream
.
write
(
fs
%
msg
)
stream
.
write
(
msg
)
stream
.
write
(
self
.
terminator
)
self
.
flush
()
except
(
KeyboardInterrupt
,
SystemExit
):
raise
...
...
Misc/NEWS
View file @
2a20dfc2
...
...
@@ -34,6 +34,8 @@ Core and Builtins
Library
-------
- logging: Made StreamHandler terminator configurable.
- logging: Allowed filters to be just callables.
- logging: Added tests for _logRecordClass changes.
...
...
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