Replies: 1 comment 1 reply
-
Looks good! Let's get it into MkDocs. Just not sure if all plugins will want the prefix to be present in all messages. But it's good for consistency to be opinionated. So nothing to change. But a nitpick on this initial code:
|
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I find myself duplicating this code in every MkDocs plugin I create:
This way I can simply get a logger with
logger = get_logger(__name__)
, and log normally withlogger.info("...")
, while all messages are correctly picked up by MkDocs logging system, and all messages are prefixed with the plugin package name.It's a bit annoying to see different styles of logging in MkDocs output depending on the plugin. Some of them don't even hook into MkDocs' logger. It would be nice to offer and advertise a standard way to log things from plugins. Logs would be uniform across all plugins 🙂
Let me know what you think and I can open a PR if you like the idea.
Also, if there's already a way and I missed it, let me know! There were many new, cool features/refactor implemented and I'm not yet familiar with all of them 🙂
Finally, if this is not deemed worth it, I'm happy to provide this as a
mkdocs-logging
library.Beta Was this translation helpful? Give feedback.
All reactions