RoySmith added a comment.
OK, so it seems like what has to happen is to define a new subclass of
ABUIC, called null_interface. It looks like it could be almost the same as
buffer_interface, except that it wouldn't attach any handers at all. Maybe
instead of:
self.log_handler = logging.handlers.QueueHandler(self._buffer)
it would have
self.log_handler = logging.NullHandler()
Then somebody who wanted the normal logging behavior could just call
pywikibot.bot.set_interface("null") before calling pywikibot.Site(). At least
that's how it looks from my reading of the code.
I see that pywikibot.Site() has an "interface" parameter. That's not
related, is it? From experimentation, calling Site() is when the handlers get
attached, but I've been unable to trace through the code how that happens. I
only see 3 places in the codebase where set_interface() is called
<https://github.com/wikimedia/pywikibot/search?q=set_interface>, and they're
all in tests.
The last piece I'm not grokking is where the "pywiki" logger has its
propagate attribute set to False. That would need to get changed to True, to
let everything flow up the the root logger. pywikibot/bot.py has:
root_logger = logging.getLogger('pywiki')
which is confusing at best. The root logger is what you get by calling
logging.getLogger() with no arguments.
TASK DETAIL
https://phabricator.wikimedia.org/T326650
EMAIL PREFERENCES
https://phabricator.wikimedia.org/settings/panel/emailpreferences/
To: RoySmith
Cc: Xqt, William_Avery, Aklapper, pywikibot-bugs-list, RoySmith, PotsdamLamb,
Jyoo1011, JohnsonLee01, SHEKH, Dijkstra, Khutuck, Zkhalido, Viztor, Wenyi,
Tbscho, MayS, Framawiki, Mdupont, JJMC89, Dvorapa, Altostratus, Avicennasis,
mys_721tx, jayvdb, Masti, Alchimista
_______________________________________________
pywikibot-bugs mailing list -- [email protected]
To unsubscribe send an email to [email protected]