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
27f48979
Kaydet (Commit)
27f48979
authored
Mar 13, 2012
tarafından
Vinay Sajip
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Closes #14267: Corrected computation of rollover filename.
üst
1732ab4f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
6 deletions
+15
-6
handlers.py
Lib/logging/handlers.py
+15
-6
No files found.
Lib/logging/handlers.py
Dosyayı görüntüle @
27f48979
...
@@ -270,9 +270,10 @@ class TimedRotatingFileHandler(BaseRotatingHandler):
...
@@ -270,9 +270,10 @@ class TimedRotatingFileHandler(BaseRotatingHandler):
dstAtRollover
=
time
.
localtime
(
newRolloverAt
)[
-
1
]
dstAtRollover
=
time
.
localtime
(
newRolloverAt
)[
-
1
]
if
dstNow
!=
dstAtRollover
:
if
dstNow
!=
dstAtRollover
:
if
not
dstNow
:
# DST kicks in before next rollover, so we need to deduct an hour
if
not
dstNow
:
# DST kicks in before next rollover, so we need to deduct an hour
newRolloverAt
=
newRolloverAt
-
3600
addend
=
-
3600
else
:
# DST bows out before next rollover, so we need to add an hour
else
:
# DST bows out before next rollover, so we need to add an hour
newRolloverAt
=
newRolloverAt
+
3600
addend
=
3600
newRolloverAt
+=
addend
result
=
newRolloverAt
result
=
newRolloverAt
return
result
return
result
...
@@ -323,11 +324,20 @@ class TimedRotatingFileHandler(BaseRotatingHandler):
...
@@ -323,11 +324,20 @@ class TimedRotatingFileHandler(BaseRotatingHandler):
self
.
stream
.
close
()
self
.
stream
.
close
()
self
.
stream
=
None
self
.
stream
=
None
# get the time that this sequence started at and make it a TimeTuple
# get the time that this sequence started at and make it a TimeTuple
currentTime
=
int
(
time
.
time
())
dstNow
=
time
.
localtime
(
currentTime
)[
-
1
]
t
=
self
.
rolloverAt
-
self
.
interval
t
=
self
.
rolloverAt
-
self
.
interval
if
self
.
utc
:
if
self
.
utc
:
timeTuple
=
time
.
gmtime
(
t
)
timeTuple
=
time
.
gmtime
(
t
)
else
:
else
:
timeTuple
=
time
.
localtime
(
t
)
timeTuple
=
time
.
localtime
(
t
)
dstThen
=
timeTuple
[
-
1
]
if
dstNow
!=
dstThen
:
if
dstNow
:
addend
=
3600
else
:
addend
=
-
3600
timeTuple
=
time
.
localtime
(
t
+
addend
)
dfn
=
self
.
baseFilename
+
"."
+
time
.
strftime
(
self
.
suffix
,
timeTuple
)
dfn
=
self
.
baseFilename
+
"."
+
time
.
strftime
(
self
.
suffix
,
timeTuple
)
if
os
.
path
.
exists
(
dfn
):
if
os
.
path
.
exists
(
dfn
):
os
.
remove
(
dfn
)
os
.
remove
(
dfn
)
...
@@ -337,19 +347,18 @@ class TimedRotatingFileHandler(BaseRotatingHandler):
...
@@ -337,19 +347,18 @@ class TimedRotatingFileHandler(BaseRotatingHandler):
os
.
remove
(
s
)
os
.
remove
(
s
)
self
.
mode
=
'w'
self
.
mode
=
'w'
self
.
stream
=
self
.
_open
()
self
.
stream
=
self
.
_open
()
currentTime
=
int
(
time
.
time
())
newRolloverAt
=
self
.
computeRollover
(
currentTime
)
newRolloverAt
=
self
.
computeRollover
(
currentTime
)
while
newRolloverAt
<=
currentTime
:
while
newRolloverAt
<=
currentTime
:
newRolloverAt
=
newRolloverAt
+
self
.
interval
newRolloverAt
=
newRolloverAt
+
self
.
interval
#If DST changes and midnight or weekly rollover, adjust for this.
#If DST changes and midnight or weekly rollover, adjust for this.
if
(
self
.
when
==
'MIDNIGHT'
or
self
.
when
.
startswith
(
'W'
))
and
not
self
.
utc
:
if
(
self
.
when
==
'MIDNIGHT'
or
self
.
when
.
startswith
(
'W'
))
and
not
self
.
utc
:
dstNow
=
time
.
localtime
(
currentTime
)[
-
1
]
dstAtRollover
=
time
.
localtime
(
newRolloverAt
)[
-
1
]
dstAtRollover
=
time
.
localtime
(
newRolloverAt
)[
-
1
]
if
dstNow
!=
dstAtRollover
:
if
dstNow
!=
dstAtRollover
:
if
not
dstNow
:
# DST kicks in before next rollover, so we need to deduct an hour
if
not
dstNow
:
# DST kicks in before next rollover, so we need to deduct an hour
newRolloverAt
=
newRolloverAt
-
3600
addend
=
-
3600
else
:
# DST bows out before next rollover, so we need to add an hour
else
:
# DST bows out before next rollover, so we need to add an hour
newRolloverAt
=
newRolloverAt
+
3600
addend
=
3600
newRolloverAt
+=
addend
self
.
rolloverAt
=
newRolloverAt
self
.
rolloverAt
=
newRolloverAt
class
WatchedFileHandler
(
logging
.
FileHandler
):
class
WatchedFileHandler
(
logging
.
FileHandler
):
...
...
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