Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gevent
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
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
gevent
Commits
802c1e85
Commit
802c1e85
authored
Mar 01, 2016
by
Jason Madden
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix #756. Don't throw extra newlines on log messages sent to a Logger.
parent
987d621e
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
14 additions
and
2 deletions
+14
-2
changelog.rst
changelog.rst
+3
-0
gevent/pywsgi.py
gevent/pywsgi.py
+6
-0
greentest/test__pywsgi.py
greentest/test__pywsgi.py
+5
-2
No files found.
changelog.rst
View file @
802c1e85
...
@@ -23,6 +23,9 @@
...
@@ -23,6 +23,9 @@
waiting greenlets in the same (unspecified) order. Previously,
waiting greenlets in the same (unspecified) order. Previously,
``AsyncResult`` tended to use a FIFO order, but this was never
``AsyncResult`` tended to use a FIFO order, but this was never
guaranteed. Both classes also use less per-instance memory.
guaranteed. Both classes also use less per-instance memory.
- Using a :class:`~logging.Logger` as a :mod:`pywsgi` error or request
log stream no longer produces extra newlines. Reported in
:issue:`756` by ael-code.
.. _bug 13502: http://bugs.python.org/issue13502
.. _bug 13502: http://bugs.python.org/issue13502
...
...
gevent/pywsgi.py
View file @
802c1e85
...
@@ -1059,6 +1059,10 @@ class LoggingLogAdapter(object):
...
@@ -1059,6 +1059,10 @@ class LoggingLogAdapter(object):
Attributes not present on this object are proxied to the underlying
Attributes not present on this object are proxied to the underlying
logger instance. This permits using custom :class:`~logging.Logger`
logger instance. This permits using custom :class:`~logging.Logger`
subclasses (or indeed, even duck-typed objects).
subclasses (or indeed, even duck-typed objects).
.. versionchanged:: 1.1
Strip trailing newline characters on the message passed to :meth:`write`
because log handlers will usually add one themselves.
"""
"""
# gevent avoids importing and using logging because importing it and
# gevent avoids importing and using logging because importing it and
...
@@ -1074,6 +1078,8 @@ class LoggingLogAdapter(object):
...
@@ -1074,6 +1078,8 @@ class LoggingLogAdapter(object):
self
.
_level
=
level
self
.
_level
=
level
def
write
(
self
,
msg
):
def
write
(
self
,
msg
):
if
msg
and
msg
.
endswith
(
'
\
n
'
):
msg
=
msg
[:
-
1
]
self
.
_logger
.
log
(
self
.
_level
,
msg
)
self
.
_logger
.
log
(
self
.
_level
,
msg
)
def
flush
(
self
):
def
flush
(
self
):
...
...
greentest/test__pywsgi.py
View file @
802c1e85
...
@@ -1528,8 +1528,11 @@ class TestLogging(TestCase):
...
@@ -1528,8 +1528,11 @@ class TestLogging(TestCase):
def
test_status_log
(
self
):
def
test_status_log
(
self
):
# Issue 664: Make sure we format the status line as a string
# Issue 664: Make sure we format the status line as a string
self
.
urlopen
()
self
.
urlopen
()
self
.
assertTrue
(
'"GET / HTTP/1.1" 200 '
in
self
.
server
.
log
.
logged
[
1
],
msg
=
self
.
server
.
log
.
logged
[
1
]
self
.
server
.
log
.
logged
[
1
])
self
.
assertTrue
(
'"GET / HTTP/1.1" 200 '
in
msg
,
msg
)
# Issue 756: Make sure we don't throw a newline on the end
self
.
assertTrue
(
'
\
n
'
not
in
msg
,
msg
)
del
CommonTests
del
CommonTests
...
...
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