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
e7d4066c
Kaydet (Commit)
e7d4066c
authored
Eki 03, 2004
tarafından
Vinay Sajip
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Changes made to maintain 1.5.2 compatibility.
üst
2d5fee06
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
6 deletions
+27
-6
handlers.py
Lib/logging/handlers.py
+27
-6
No files found.
Lib/logging/handlers.py
Dosyayı görüntüle @
e7d4066c
...
@@ -182,7 +182,7 @@ class TimedRotatingFileHandler(BaseRotatingHandler):
...
@@ -182,7 +182,7 @@ class TimedRotatingFileHandler(BaseRotatingHandler):
else
:
else
:
raise
ValueError
(
"Invalid rollover interval specified:
%
s"
%
self
.
when
)
raise
ValueError
(
"Invalid rollover interval specified:
%
s"
%
self
.
when
)
self
.
interval
*=
interval
# multiply by units requested
self
.
interval
=
self
.
interval
*
interval
# multiply by units requested
self
.
rolloverAt
=
currentTime
+
self
.
interval
self
.
rolloverAt
=
currentTime
+
self
.
interval
# If we are rolling over at midnight or weekly, then the interval is already known.
# If we are rolling over at midnight or weekly, then the interval is already known.
...
@@ -200,8 +200,8 @@ class TimedRotatingFileHandler(BaseRotatingHandler):
...
@@ -200,8 +200,8 @@ class TimedRotatingFileHandler(BaseRotatingHandler):
currentSecond
=
t
[
5
]
currentSecond
=
t
[
5
]
# r is the number of seconds left between now and midnight
# r is the number of seconds left between now and midnight
r
=
(
24
-
currentHour
)
*
60
*
60
# number of hours in seconds
r
=
(
24
-
currentHour
)
*
60
*
60
# number of hours in seconds
r
+=
(
59
-
currentMinute
)
*
60
# plus the number of minutes (in secs)
r
=
r
+
(
59
-
currentMinute
)
*
60
# plus the number of minutes (in secs)
r
+=
(
59
-
currentSecond
)
# plus the number of seconds
r
=
r
+
(
59
-
currentSecond
)
# plus the number of seconds
self
.
rolloverAt
=
currentTime
+
r
self
.
rolloverAt
=
currentTime
+
r
# If we are rolling over on a certain day, add in the number of days until
# If we are rolling over on a certain day, add in the number of days until
# the next rollover, but offset by 1 since we just calculated the time
# the next rollover, but offset by 1 since we just calculated the time
...
@@ -219,10 +219,10 @@ class TimedRotatingFileHandler(BaseRotatingHandler):
...
@@ -219,10 +219,10 @@ class TimedRotatingFileHandler(BaseRotatingHandler):
day
=
t
[
6
]
# 0 is Monday
day
=
t
[
6
]
# 0 is Monday
if
day
>
self
.
dayOfWeek
:
if
day
>
self
.
dayOfWeek
:
daysToWait
=
(
day
-
self
.
dayOfWeek
)
-
1
daysToWait
=
(
day
-
self
.
dayOfWeek
)
-
1
self
.
rolloverAt
+=
(
daysToWait
*
(
60
*
60
*
24
))
self
.
rolloverAt
=
self
.
rolloverAt
+
(
daysToWait
*
(
60
*
60
*
24
))
if
day
<
self
.
dayOfWeek
:
if
day
<
self
.
dayOfWeek
:
daysToWait
=
(
6
-
self
.
dayOfWeek
)
+
day
daysToWait
=
(
6
-
self
.
dayOfWeek
)
+
day
self
.
rolloverAt
+=
(
daysToWait
*
(
60
*
60
*
24
))
self
.
rolloverAt
=
self
.
rolloverAt
+
(
daysToWait
*
(
60
*
60
*
24
))
#print "Will rollover at %d, %d seconds from now" % (self.rolloverAt, self.rolloverAt - currentTime)
#print "Will rollover at %d, %d seconds from now" % (self.rolloverAt, self.rolloverAt - currentTime)
...
@@ -656,6 +656,24 @@ class SMTPHandler(logging.Handler):
...
@@ -656,6 +656,24 @@ class SMTPHandler(logging.Handler):
"""
"""
return
self
.
subject
return
self
.
subject
weekdayname
=
[
'Mon'
,
'Tue'
,
'Wed'
,
'Thu'
,
'Fri'
,
'Sat'
,
'Sun'
]
monthname
=
[
None
,
'Jan'
,
'Feb'
,
'Mar'
,
'Apr'
,
'May'
,
'Jun'
,
'Jul'
,
'Aug'
,
'Sep'
,
'Oct'
,
'Nov'
,
'Dec'
]
def
date_time
(
self
):
"""
Return the current date and time formatted for a MIME header.
Needed for Python 1.5.2 (no email package available)
"""
year
,
month
,
day
,
hh
,
mm
,
ss
,
wd
,
y
,
z
=
time
.
gmtime
(
time
.
time
())
s
=
"
%
s,
%02
d
%3
s
%4
d
%02
d:
%02
d:
%02
d GMT"
%
(
self
.
weekdayname
[
wd
],
day
,
self
.
monthname
[
month
],
year
,
hh
,
mm
,
ss
)
return
s
def
emit
(
self
,
record
):
def
emit
(
self
,
record
):
"""
"""
Emit a record.
Emit a record.
...
@@ -664,7 +682,10 @@ class SMTPHandler(logging.Handler):
...
@@ -664,7 +682,10 @@ class SMTPHandler(logging.Handler):
"""
"""
try
:
try
:
import
smtplib
import
smtplib
from
email.Utils
import
formatdate
try
:
from
email.Utils
import
formatdate
except
:
formatdate
=
self
.
date_time
port
=
self
.
mailport
port
=
self
.
mailport
if
not
port
:
if
not
port
:
port
=
smtplib
.
SMTP_PORT
port
=
smtplib
.
SMTP_PORT
...
...
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