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
376e636f
Kaydet (Commit)
376e636f
authored
Nis 25, 2003
tarafından
Guido van Rossum
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
New version from Vinaj, should solve the threading problems (hopefully).
üst
7d9963fe
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
7 deletions
+18
-7
test_logging
Lib/test/output/test_logging
+2
-2
test_logging.py
Lib/test/test_logging.py
+16
-5
No files found.
Lib/test/output/test_logging
Dosyayı görüntüle @
376e636f
...
...
@@ -25,7 +25,7 @@ WARNING:UNDEF:Message 21
INFO:UNDEF:Message 22
CRITICAL:INF.BADPARENT.UNDEF:Message 23
CRITICAL:INF.BADPARENT:Message 24
INFO:INF:Messages should bear numbers 0 through 24.
INFO:INF:
Finish up, it's closing time.
Messages should bear numbers 0 through 24.
-- log_test0 end ---------------------------------------------------
-- log_test1 begin ---------------------------------------------------
-- setting logging level to 'Boring' -----
...
...
@@ -511,5 +511,5 @@ UNDEF -> WARNING: Message 21 (via logrecv.tcp.UNDEF)
UNDEF -> INFO: Message 22 (via logrecv.tcp.UNDEF)
INF.BADPARENT.UNDEF -> CRITICAL: Message 23 (via logrecv.tcp.INF.BADPARENT.UNDEF)
INF.BADPARENT -> CRITICAL: Message 24 (via logrecv.tcp.INF.BADPARENT)
INF -> INFO: Messages should bear numbers 0 through 24. (via logrecv.tcp.INF)
INF -> INFO:
Finish up, it's closing time.
Messages should bear numbers 0 through 24. (via logrecv.tcp.INF)
-- logrecv output end ---------------------------------------------------
Lib/test/test_logging.py
Dosyayı görüntüle @
376e636f
...
...
@@ -38,6 +38,8 @@ except (ValueError, locale.Error):
BANNER
=
"--
%-10
s
%-6
s ---------------------------------------------------
\n
"
FINISH_UP
=
"Finish up, it's closing time. Messages should bear numbers 0 through 24."
#----------------------------------------------------------------------------
# Log receiver
#----------------------------------------------------------------------------
...
...
@@ -79,10 +81,15 @@ class LogRecordStreamHandler(StreamRequestHandler):
def
handleLogRecord
(
self
,
record
):
logname
=
"logrecv.tcp."
+
record
.
name
#If the end-of-messages sentinel is seen, tell the server to terminate
if
record
.
msg
==
FINISH_UP
:
self
.
server
.
abort
=
1
record
.
msg
=
record
.
msg
+
" (via "
+
logname
+
")"
logger
=
logging
.
getLogger
(
logname
)
logger
.
handle
(
record
)
socketDataProcessed
=
threading
.
Condition
()
class
LogRecordSocketReceiver
(
ThreadingTCPServer
):
"""
A simple-minded TCP socket-based logging receiver suitable for test
...
...
@@ -107,6 +114,10 @@ class LogRecordSocketReceiver(ThreadingTCPServer):
if
rd
:
self
.
handle_request
()
abort
=
self
.
abort
#notify the main thread that we're about to exit
socketDataProcessed
.
acquire
()
socketDataProcessed
.
notify
()
socketDataProcessed
.
release
()
def
process_request
(
self
,
request
,
client_address
):
#import threading
...
...
@@ -195,7 +206,7 @@ def test0():
INF_ERR_UNDEF
.
info
(
nextmessage
())
INF_ERR_UNDEF
.
debug
(
nextmessage
())
INF
.
info
(
"Messages should bear numbers 0 through 24."
)
INF
.
info
(
FINISH_UP
)
#----------------------------------------------------------------------------
# Test 1
...
...
@@ -455,10 +466,10 @@ def test_main():
banner
(
"log_test3"
,
"end"
)
finally
:
#
shut down server
tcpserver
.
abort
=
1
for
thread
in
threads
:
thread
.
join
()
#
wait for TCP receiver to terminate
socketDataProcessed
.
acquire
()
socketDataProcessed
.
wait
()
socketDataProcessed
.
release
()
banner
(
"logrecv output"
,
"begin"
)
sys
.
stdout
.
write
(
sockOut
.
getvalue
())
sockOut
.
close
()
...
...
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