Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
cpython
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
cpython
Commits
57c22379
Kaydet (Commit)
57c22379
authored
Şub 23, 2012
tarafından
Vinay Sajip
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Sade Fark
Merged logging flush/close changes from 3.2.
üst
c4c90bdf
0abf61db
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
33 additions
and
27 deletions
+33
-27
__init__.py
Lib/logging/__init__.py
+12
-10
handlers.py
Lib/logging/handlers.py
+21
-17
No files found.
Lib/logging/__init__.py
Dosyayı görüntüle @
57c22379
...
...
@@ -16,9 +16,9 @@
"""
Logging package for Python. Based on PEP 282 and comments thereto in
comp.lang.python
, and influenced by Apache's log4j system
.
comp.lang.python.
Copyright (C) 2001-201
1
Vinay Sajip. All Rights Reserved.
Copyright (C) 2001-201
2
Vinay Sajip. All Rights Reserved.
To use, simply 'import logging' and log away!
"""
...
...
@@ -914,8 +914,9 @@ class StreamHandler(Handler):
"""
Flushes the stream.
"""
if
self
.
stream
and
hasattr
(
self
.
stream
,
"flush"
):
self
.
stream
.
flush
()
with
self
.
lock
:
if
self
.
stream
and
hasattr
(
self
.
stream
,
"flush"
):
self
.
stream
.
flush
()
def
emit
(
self
,
record
):
"""
...
...
@@ -964,12 +965,13 @@ class FileHandler(StreamHandler):
"""
Closes the stream.
"""
if
self
.
stream
:
self
.
flush
()
if
hasattr
(
self
.
stream
,
"close"
):
self
.
stream
.
close
()
StreamHandler
.
close
(
self
)
self
.
stream
=
None
with
self
.
lock
:
if
self
.
stream
:
self
.
flush
()
if
hasattr
(
self
.
stream
,
"close"
):
self
.
stream
.
close
()
StreamHandler
.
close
(
self
)
self
.
stream
=
None
def
_open
(
self
):
"""
...
...
Lib/logging/handlers.py
Dosyayı görüntüle @
57c22379
# Copyright 2001-201
0
by Vinay Sajip. All Rights Reserved.
# Copyright 2001-201
2
by Vinay Sajip. All Rights Reserved.
#
# Permission to use, copy, modify, and distribute this software and its
# documentation for any purpose and without fee is hereby granted,
...
...
@@ -16,10 +16,9 @@
"""
Additional handlers for the logging package for Python. The core package is
based on PEP 282 and comments thereto in comp.lang.python, and influenced by
Apache's log4j system.
based on PEP 282 and comments thereto in comp.lang.python.
Copyright (C) 2001-201
0
Vinay Sajip. All Rights Reserved.
Copyright (C) 2001-201
2
Vinay Sajip. All Rights Reserved.
To use, simply 'import logging.handlers' and log away!
"""
...
...
@@ -594,10 +593,11 @@ class SocketHandler(logging.Handler):
"""
Closes the socket.
"""
if
self
.
sock
:
self
.
sock
.
close
()
self
.
sock
=
None
logging
.
Handler
.
close
(
self
)
with
self
.
lock
:
if
self
.
sock
:
self
.
sock
.
close
()
self
.
sock
=
None
logging
.
Handler
.
close
(
self
)
class
DatagramHandler
(
SocketHandler
):
"""
...
...
@@ -792,8 +792,9 @@ class SysLogHandler(logging.Handler):
"""
Closes the socket.
"""
self
.
socket
.
close
()
logging
.
Handler
.
close
(
self
)
with
self
.
lock
:
self
.
socket
.
close
()
logging
.
Handler
.
close
(
self
)
def
mapPriority
(
self
,
levelName
):
"""
...
...
@@ -1137,7 +1138,8 @@ class BufferingHandler(logging.Handler):
This version just zaps the buffer to empty.
"""
self
.
buffer
=
[]
with
self
.
lock
:
self
.
buffer
=
[]
def
close
(
self
):
"""
...
...
@@ -1187,18 +1189,20 @@ class MemoryHandler(BufferingHandler):
The record buffer is also cleared by this operation.
"""
if
self
.
target
:
for
record
in
self
.
buffer
:
self
.
target
.
handle
(
record
)
self
.
buffer
=
[]
with
self
.
lock
:
if
self
.
target
:
for
record
in
self
.
buffer
:
self
.
target
.
handle
(
record
)
self
.
buffer
=
[]
def
close
(
self
):
"""
Flush, set the target to None and lose the buffer.
"""
self
.
flush
()
self
.
target
=
None
BufferingHandler
.
close
(
self
)
with
self
.
lock
:
self
.
target
=
None
BufferingHandler
.
close
(
self
)
class
QueueHandler
(
logging
.
Handler
):
...
...
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