On Jan 4, 2023, at 7:25 PM, Roy Smith
<roy(a)panix.com> wrote:
PS, quoting from
https://docs.python.org/3.9/howto/logging.html#logging-advanced-tutorial
<https://docs.python.org/3.9/howto/logging.html#logging-advanced-tutorial>...
Note It is strongly advised that you do not add
any handlers other than NullHandler to your library’s loggers. This is because the
configuration of handlers is the prerogative of the application developer who uses your
library. The application developer knows their target audience and what handlers are most
appropriate for their application: if you add handlers ‘under the hood’, you might well
interfere with their ability to carry out unit tests and deliver logs which suit their
requirements.
On Jan 4, 2023, at 7:14 PM, Roy Smith
<roy(a)panix.com <mailto:roy@panix.com>> wrote:
Pywikibot, even if you're just using it as a library, configures its own complicated
logging structure:
o "pywiki"
| Level Level 11
| Propagate OFF
| Handler <TerminalHandler <stderr> (INFO)>
| Level INFO
| Filter <pywikibot.userinterfaces.terminal_interface_base.MaxLevelFilter
object at 0x7f7f66dafe50>
| Formatter fmt='%(message)s%(newline)s' datefmt=None
| Handler <TerminalHandler <stdout> (STDOUT)>
| Level STDOUT
| Filter <pywikibot.userinterfaces.terminal_interface_base.MaxLevelFilter
object at 0x7f7f66daffa0>
| Formatter fmt='%(message)s%(newline)s' datefmt=None
| Handler <TerminalHandler <stderr> (WARNING)>
| Level WARNING
| Formatter fmt='%(levelname)s: %(message)s%(newline)s' datefmt=None
| |
| o<--[pywiki.wiki]
| |
| o<--"pywiki.wiki.family"
| Level NOTSET so inherits level Level 11
|
Is there any way to make it not do this? I want to have full control of the logging
config in my application. In particular, I want all the logging to go to my logfile.
Having a library install its own handlers which are hard-wired to a TerminalHandler just
complicates that.
_______________________________________________
pywikibot mailing list -- pywikibot(a)lists.wikimedia.org
<mailto:pywikibot@lists.wikimedia.org>
To unsubscribe send an email to pywikibot-leave(a)lists.wikimedia.org
<mailto:pywikibot-leave@lists.wikimedia.org>