jenkins-bot has submitted this change. ( 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/907494 )

Change subject: [log] Disable command.log if -nolog option is given
......................................................................

[log] Disable command.log if -nolog option is given

Bug: T334381
Change-Id: Ic31b94adcc2bf140258cbe632edceddb1edeb290
---
M pywikibot/bot.py
1 file changed, 17 insertions(+), 1 deletion(-)

Approvals:
  BinĂ¡ris: Looks good to me, approved
  jenkins-bot: Verified




diff --git a/pywikibot/bot.py b/pywikibot/bot.py
index 26559a9..a15efd7 100644
--- a/pywikibot/bot.py
+++ b/pywikibot/bot.py
@@ -228,6 +228,7 @@
 -log:xyz          Enable the log file, using 'xyz' as the filename.

 -nolog            Disable the log file (if it is enabled by default).
+                  Also disable command.log.

 -maxlag           Sets a new maxlag parameter to a number of seconds.
                   Defer bot edits during periods of database server lag.
@@ -888,6 +889,8 @@
     .. versionchanged:: 8.0
        Short site value can be given if site code is equal to family
        like ``-site:meta``.
+    .. versionchanged:: 8.1
+       ``-nolog`` option also discards command.log.

     :param args: Command line arguments. If None,
         :meth:`pywikibot.argvu<userinterfaces._interface_base.ABUIC.argvu>`
@@ -911,6 +914,7 @@
     module_name = calledModuleName() or 'terminal-interface'
     non_global_args = []
     username = None
+    commandlog = True
     do_help_val: Union[bool, str, None] = None if do_help else False
     assert args is not None
     for arg in args:
@@ -939,6 +943,7 @@
             if value:
                 config.logfilename = value
         elif option == '-nolog':
+            commandlog = False
             config.log = []
         elif option in ('-cosmeticchanges', '-cc'):
             config.cosmetic_changes = (strtobool(value) if value
@@ -1008,7 +1013,8 @@
         config.usernames[config.family][config.mylang] = username

     init_handlers()
-    writeToCommandLogFile()
+    if commandlog:
+        writeToCommandLogFile()

     if config.verbose_output:
         pywikibot.info('Python ' + sys.version)

--
To view, visit https://gerrit.wikimedia.org/r/c/pywikibot/core/+/907494
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.wikimedia.org/r/settings

Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: Ic31b94adcc2bf140258cbe632edceddb1edeb290
Gerrit-Change-Number: 907494
Gerrit-PatchSet: 1
Gerrit-Owner: Xqt <[email protected]>
Gerrit-Reviewer: BinĂ¡ris <[email protected]>
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged
_______________________________________________
Pywikibot-commits mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to