-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Provide Module
-specific Logger
#904
base: develop
Are you sure you want to change the base?
Conversation
Introduces `log`-member to Modules, so logs can be filtered by module and are also printed so to the local formatter, using 'Module: message'. No need to import logging to all your ViUR modules anymore, just use `self.log`.
7dacb4b
to
868c5f3
Compare
Module
-specific Logger
@@ -110,6 +110,10 @@ def format(self, record: logging.LogRecord) -> str: | |||
|
|||
record.pathname = pathname | |||
|
|||
# Show logger-name before message when not "root" logger | |||
if record.name != "root": |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, but this condition is not good. This effects all other loggers. Not only the module-loggers.
The logging in the viur-core is general kinda hackish. Using the root logger is a bad practise, because usually all loggers of other packages propagates to it. Which results in workaround like this.
I have long wanted to rework the logging and work with sub loggers... Maybe this would be a good time to combine this. Give me a bit of time to evaluate and get this done.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, let's put this thing on hold. You can also create a follow-up PR based on this, if it's easier.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am working on #1080
Introduces
log
-member to Modules, so logs can be filtered by module and are also printed so to the local formatter, using 'Module: message'. No need to import logging to all your ViUR modules anymore, just useself.log
.