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
50198222
Commit
50198222
authored
Feb 23, 2012
by
Vinay Sajip
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix added for recent changes in non-threading environments.
parent
16f6a29b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
7 deletions
+28
-7
Lib/logging/__init__.py
Lib/logging/__init__.py
+8
-2
Lib/logging/handlers.py
Lib/logging/handlers.py
+20
-5
No files found.
Lib/logging/__init__.py
View file @
50198222
...
...
@@ -828,9 +828,12 @@ class StreamHandler(Handler):
"""
Flushes the stream.
"""
with
self
.
lock
:
self
.
acquire
()
try
:
if
self
.
stream
and
hasattr
(
self
.
stream
,
"flush"
):
self
.
stream
.
flush
()
finally
:
self
.
release
()
def
emit
(
self
,
record
):
"""
...
...
@@ -901,13 +904,16 @@ class FileHandler(StreamHandler):
"""
Closes the stream.
"""
with
self
.
lock
:
self
.
acquire
()
try
:
if
self
.
stream
:
self
.
flush
()
if
hasattr
(
self
.
stream
,
"close"
):
self
.
stream
.
close
()
StreamHandler
.
close
(
self
)
self
.
stream
=
None
finally
:
self
.
release
()
def
_open
(
self
):
"""
...
...
Lib/logging/handlers.py
View file @
50198222
...
...
@@ -562,10 +562,13 @@ class SocketHandler(logging.Handler):
"""
Closes the socket.
"""
with
self
.
lock
:
self
.
acquire
()
try
:
if
self
.
sock
:
self
.
sock
.
close
()
self
.
sock
=
None
finally
:
self
.
release
()
logging
.
Handler
.
close
(
self
)
class
DatagramHandler
(
SocketHandler
):
...
...
@@ -767,9 +770,12 @@ class SysLogHandler(logging.Handler):
"""
Closes the socket.
"""
with
self
.
lock
:
self
.
acquire
()
try
:
if
self
.
unixsocket
:
self
.
socket
.
close
()
finally
:
self
.
release
()
logging
.
Handler
.
close
(
self
)
def
mapPriority
(
self
,
levelName
):
...
...
@@ -1097,8 +1103,11 @@ class BufferingHandler(logging.Handler):
This version just zaps the buffer to empty.
"""
with
self
.
lock
:
self
.
acquire
()
try
:
self
.
buffer
=
[]
finally
:
self
.
release
()
def
close
(
self
):
"""
...
...
@@ -1146,17 +1155,23 @@ class MemoryHandler(BufferingHandler):
records to the target, if there is one. Override if you want
different behaviour.
"""
with
self
.
lock
:
self
.
acquire
()
try
:
if
self
.
target
:
for
record
in
self
.
buffer
:
self
.
target
.
handle
(
record
)
self
.
buffer
=
[]
finally
:
self
.
release
()
def
close
(
self
):
"""
Flush, set the target to None and lose the buffer.
"""
self
.
flush
()
with
self
.
lock
:
self
.
acquire
()
try
:
self
.
target
=
None
BufferingHandler
.
close
(
self
)
finally
:
self
.
release
()
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