Xqt submitted this change.

View Change

Approvals: jenkins-bot: Verified Xqt: Looks good to me, approved
[doc] Explain bot.handler_namer function

Change-Id: I27ba557b1da794eb01d47a57e42b05bf03d8f407
---
M pywikibot/bot.py
1 file changed, 8 insertions(+), 0 deletions(-)

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)

To view, visit change 842493. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: I27ba557b1da794eb01d47a57e42b05bf03d8f407
Gerrit-Change-Number: 842493
Gerrit-PatchSet: 2
Gerrit-Owner: Xqt <info@gno.de>
Gerrit-Reviewer: Xqt <info@gno.de>
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged