Many current log messages look like [PLUGINNAME] message or PLUGINNAME: message and some plugins use yet another pattern. This makes it difficult to find out the message source (eg. for grouping messages after the sending plugin).
We should change the logging initialization of our plugins to logger = logging.getLogger(__name__).
This would not change the current logging output, but make it much easier for plugins to post-process logging messages.
The logger name can then be used in a user-defined format string with %(name)s to produce eg. spockbot.plugins.core.net, or accessed from the log record by adding a custom handler.
Even further, by querying the plugin loader the module name can be matched to a plugin name.
Independently, we can also avoid unnecessary processing. If someone really needs that, it can always be turned back on by the user.
Many current log messages look like
[PLUGINNAME] message
orPLUGINNAME: message
and some plugins use yet another pattern. This makes it difficult to find out the message source (eg. for grouping messages after the sending plugin).We should change the logging initialization of our plugins to
logger = logging.getLogger(__name__)
. This would not change the current logging output, but make it much easier for plugins to post-process logging messages.The logger name can then be used in a user-defined format string with
%(name)s
to produce eg.spockbot.plugins.core.net
, or accessed from the log record by adding a custom handler. Even further, by querying the plugin loader the module name can be matched to a plugin name.Independently, we can also avoid unnecessary processing. If someone really needs that, it can always be turned back on by the user.