Xqt has submitted this change. ( https://gerrit.wikimedia.org/r/c/pywikibot/core/+/842493 )
Change subject: [doc] Explain bot.handler_namer function ......................................................................
[doc] Explain bot.handler_namer function
Change-Id: I27ba557b1da794eb01d47a57e42b05bf03d8f407 --- M pywikibot/bot.py 1 file changed, 8 insertions(+), 0 deletions(-)
Approvals: jenkins-bot: Verified Xqt: Looks good to me, approved
diff --git a/pywikibot/bot.py b/pywikibot/bot.py index 87d057a..d85f473 100644 --- a/pywikibot/bot.py +++ b/pywikibot/bot.py @@ -306,6 +306,14 @@ def handler_namer(name: str) -> str: """Modify the filename of a log file when rotating.
+ RotatingFileHandler will save old log files by appending the + extensions ``.1``, ``.2`` etc., to the filename. To keep the + original extension, which is usually ``.log``, this function + swaps the appended counter with the log extension: + + >>> handler_namer('add_text.log.1') + 'add_text.1.log' + .. versionadded:: 6.5 """ path, qualifier = name.rsplit('.', 1)
pywikibot-commits@lists.wikimedia.org