FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

gh-90535: Fix support of interval>1 in logging.TimedRotatingFileHandler by serhiy-storchaka · Pull Request #116220 · python/cpython · GitHub

Repository navigation

gh-90535: Fix support of interval>1 in logging.TimedRotatingFileHandler - #116220

Merged
serhiy-storchaka merged 3 commits into
python:mainfrom
serhiy-storchaka:logging-rotate-interwal
Mar 16, 2024
Merged

serhiy-storchaka merged 3 commits into
python:mainfrom
serhiy-storchaka:logging-rotate-interwal

Conversation

serhiy-storchaka commented Mar 1, 2024 •
edited by bedevere-app Bot
Loading

Copy link
Copy Markdown
Member

Fix support of interval values > 1 in logging.TimedRotatingFileHandler for when='MIDNIGHT' and when='Wx'.

…eHandler

Fix support of interval values > 1 in logging.TimedRotatingFileHandler
for when='MIDNIGHT' and when='Wx'.

Copy link
Copy Markdown
Member Author

@vsajip, please take a look. It is a surprisingly tiny change.

vsajip left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Just one minor suggestion. Otherwise looks fine. Thank you very much for all your work on TimedRotatingFileHandler, Serhiy!

Comment thread Lib/logging/handlers.py Outdated
else:
daysToWait = 6 - day + self.dayOfWeek + 1
result += daysToWait * (60 * 60 * 24)
if self.when == 'MIDNIGHT':

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

This could be an elif, right?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

No, because the else branch should be executed when self.when.startswith('W').

I see now that two ifs can be merged:

            if self.when.startswith('W'):
                day = currentDay # 0 is Monday
                if day != self.dayOfWeek:
                    if day < self.dayOfWeek:
                        daysToWait = self.dayOfWeek - day
                    else:
                        daysToWait = 6 - day + self.dayOfWeek + 1
                    result += daysToWait * _MIDNIGHT
                result += self.interval - _MIDNIGHT * 7
            else:
                result += self.interval - _MIDNIGHT

bedevere-app Bot commented Mar 14, 2024

Copy link
Copy Markdown

When you're done making the requested changes, leave the comment: I have made the requested changes; please review again.

Copy link
Copy Markdown
Member Author

I have made the requested changes; please review again.

bedevere-app Bot commented Mar 15, 2024

Copy link
Copy Markdown

Thanks for making the requested changes!

@vsajip: please review the changes made to this pull request.

bedevere-app Bot requested a review from vsajip March 15, 2024 11:21
serhiy-storchaka merged commit 269051d into python:main Mar 16, 2024
serhiy-storchaka deleted the logging-rotate-interwal branch March 16, 2024 10:29
serhiy-storchaka added needs backport to 3.11 only security fixes needs backport to 3.12 only security fixes labels Mar 16, 2024

Copy link
Copy Markdown

Thanks @serhiy-storchaka for the PR 🌮🎉.. I'm working now to backport this PR to: 3.12.
🐍🍒⛏🤖

Copy link
Copy Markdown

Thanks @serhiy-storchaka for the PR 🌮🎉.. I'm working now to backport this PR to: 3.11.
🐍🍒⛏🤖

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Mar 16, 2024
…eHandler (pythonGH-116220)

Fix support of interval values > 1 in logging.TimedRotatingFileHandler
for when='MIDNIGHT' and when='Wx'.
(cherry picked from commit 269051d)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>

bedevere-app Bot commented Mar 16, 2024

Copy link
Copy Markdown

GH-116892 is a backport of this pull request to the 3.12 branch.

bedevere-app Bot removed the needs backport to 3.12 only security fixes label Mar 16, 2024
miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Mar 16, 2024
…eHandler (pythonGH-116220)

Fix support of interval values > 1 in logging.TimedRotatingFileHandler
for when='MIDNIGHT' and when='Wx'.
(cherry picked from commit 269051d)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>

bedevere-app Bot commented Mar 16, 2024

Copy link
Copy Markdown

GH-116893 is a backport of this pull request to the 3.11 branch.

bedevere-app Bot removed the needs backport to 3.11 only security fixes label Mar 16, 2024
serhiy-storchaka added a commit that referenced this pull request Mar 18, 2024
…leHandler (GH-116220) (GH-116892)

Fix support of interval values > 1 in logging.TimedRotatingFileHandler
for when='MIDNIGHT' and when='Wx'.
(cherry picked from commit 269051d)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
serhiy-storchaka added a commit that referenced this pull request Mar 18, 2024
…leHandler (GH-116220) (GH-116893)

Fix support of interval values > 1 in logging.TimedRotatingFileHandler
for when='MIDNIGHT' and when='Wx'.
(cherry picked from commit 269051d)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
vstinner pushed a commit to vstinner/cpython that referenced this pull request Mar 20, 2024
…eHandler (pythonGH-116220)

Fix support of interval values > 1 in logging.TimedRotatingFileHandler
for when='MIDNIGHT' and when='Wx'.
adorilson pushed a commit to adorilson/cpython that referenced this pull request Mar 25, 2024
…eHandler (pythonGH-116220)

Fix support of interval values > 1 in logging.TimedRotatingFileHandler
for when='MIDNIGHT' and when='Wx'.
diegorusso pushed a commit to diegorusso/cpython that referenced this pull request Apr 17, 2024
…eHandler (pythonGH-116220)

Fix support of interval values > 1 in logging.TimedRotatingFileHandler
for when='MIDNIGHT' and when='Wx'.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants


Back | FazBrowse Home | New Git URL