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
8d3654db
Kaydet (Commit)
8d3654db
authored
Agu 25, 2007
tarafından
Neal Norwitz
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Use unicode and add a "test" for syslog
üst
a401bbe5
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
52 additions
and
7 deletions
+52
-7
test_syslog.py
Lib/test/test_syslog.py
+37
-0
syslogmodule.c
Modules/syslogmodule.c
+15
-7
No files found.
Lib/test/test_syslog.py
0 → 100644
Dosyayı görüntüle @
8d3654db
import
syslog
import
unittest
from
test
import
test_support
# XXX(nnorwitz): This test sucks. I don't know of a platform independent way
# to verify that the messages were really logged.
# The only purpose of this test is to verify the code doesn't crash or leak.
class
Test
(
unittest
.
TestCase
):
def
test_openlog
(
self
):
syslog
.
openlog
(
'python'
)
def
test_syslog
(
self
):
syslog
.
openlog
(
'python'
)
syslog
.
syslog
(
'test message from python test_syslog'
)
syslog
.
syslog
(
syslog
.
LOG_ERR
,
'test error from python test_syslog'
)
def
test_closelog
(
self
):
syslog
.
openlog
(
'python'
)
syslog
.
closelog
()
def
test_setlogmask
(
self
):
syslog
.
setlogmask
(
syslog
.
LOG_DEBUG
)
def
test_log_mask
(
self
):
syslog
.
LOG_MASK
(
syslog
.
LOG_INFO
)
def
test_log_upto
(
self
):
syslog
.
LOG_UPTO
(
syslog
.
LOG_INFO
)
def
test_main
():
test_support
.
run_unittest
(
__name__
)
if
__name__
==
"__main__"
:
test_main
()
Modules/syslogmodule.c
Dosyayı görüntüle @
8d3654db
...
...
@@ -58,9 +58,10 @@ syslog_openlog(PyObject * self, PyObject * args)
long
logopt
=
0
;
long
facility
=
LOG_USER
;
PyObject
*
new_S_ident_o
;
const
char
*
ident
;
if
(
!
PyArg_ParseTuple
(
args
,
"
S
|ll;ident string [, logoption [, facility]]"
,
"
U
|ll;ident string [, logoption [, facility]]"
,
&
new_S_ident_o
,
&
logopt
,
&
facility
))
return
NULL
;
...
...
@@ -71,7 +72,10 @@ syslog_openlog(PyObject * self, PyObject * args)
S_ident_o
=
new_S_ident_o
;
Py_INCREF
(
S_ident_o
);
openlog
(
PyString_AsString
(
S_ident_o
),
logopt
,
facility
);
ident
=
PyUnicode_AsString
(
S_ident_o
);
if
(
ident
==
NULL
)
return
NULL
;
openlog
(
ident
,
logopt
,
facility
);
Py_INCREF
(
Py_None
);
return
Py_None
;
...
...
@@ -81,17 +85,21 @@ syslog_openlog(PyObject * self, PyObject * args)
static
PyObject
*
syslog_syslog
(
PyObject
*
self
,
PyObject
*
args
)
{
char
*
message
;
PyObject
*
message_object
;
const
char
*
message
;
int
priority
=
LOG_INFO
;
if
(
!
PyArg_ParseTuple
(
args
,
"i
s
;[priority,] message string"
,
&
priority
,
&
message
))
{
if
(
!
PyArg_ParseTuple
(
args
,
"i
U
;[priority,] message string"
,
&
priority
,
&
message
_objecct
))
{
PyErr_Clear
();
if
(
!
PyArg_ParseTuple
(
args
,
"
s
;[priority,] message string"
,
&
message
))
if
(
!
PyArg_ParseTuple
(
args
,
"
U
;[priority,] message string"
,
&
message
_objecct
))
return
NULL
;
}
message
=
PyUnicode_AsString
(
message_object
);
if
(
message
==
NULL
)
return
NULL
;
syslog
(
priority
,
"%s"
,
message
);
Py_INCREF
(
Py_None
);
return
Py_None
;
...
...
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