-
Notifications
You must be signed in to change notification settings - Fork 651
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
FIX-#4582: Inherit custom log layer #4583
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -31,10 +31,12 @@ class ClassLogger: | |
This mixin must go first in class bases declaration to have the desired effect. | ||
""" | ||
|
||
_modin_logging_layer = "PANDAS-API" | ||
|
||
@classmethod | ||
def __init_subclass__( | ||
cls, | ||
modin_layer: str = "PANDAS-API", | ||
modin_layer: Optional[str] = None, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we change Line 39 to be If not, can we also update the function comment to reflect the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @naren-ponder I think the Pythonic way here is to default to There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @devin-petersohn Makes sense. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This won't work, but for the different reason. In Python, default values are computed once at function declaration, so all instances of |
||
class_name: Optional[str] = None, | ||
log_level: Optional[str] = "info", | ||
**kwargs, | ||
|
@@ -53,5 +55,7 @@ def __init_subclass__( | |
The log level (INFO, DEBUG, WARNING, etc.). | ||
**kwargs : dict | ||
""" | ||
modin_layer = modin_layer or cls._modin_logging_layer | ||
super().__init_subclass__(**kwargs) | ||
enable_logging(modin_layer, class_name, log_level)(cls) | ||
cls._modin_logging_layer = modin_layer | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Does this change the
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, it should be doing this way. The logic here is:
|
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.
We can move this to a constant at the top of the file and it should work.
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.
If you mean declare the string as a constant outside of the class (and re-use it in this line to set the variable) then yes, sure, it will work. But why?..
Unless we want to re-use the same constant in the
@enable_logging
...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, was responding to the comment here: #4583 (comment)
I thought you were saying this didn't work as we wanted it to, my mistake. Is this ok to merge?
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.
Unless you want me to extract this constant (which I don't see much value in, TBH), it should be good to go.