-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
[Question] About logger #1168
Comments
Yeah, using logger similar to base models with singleton is okay but we will miss the module information in that case. With this approach, we can include module name into log messages easily. That is why, I added it but not used yet. TLDR: I prefer to adopt the current approach. |
Just for the sake of discussion I see some possible improvements with that approach.
This helps a lot reducing the amount of code being written and does not require to remember to update string constants on module renaming (if ever). |
1- Agree. Instead of string module name _ name _ will avoid mistakes. But end user is not using logger at all. So, giving wrong module name should not be happened. 2- suppose that one customize the logger and move logs to kafka instead of console. You will see module name in the event message. So, I think having module name is important in the logger. |
I don't mean this should impact user experience. I'm considering developer experience and code maintainability. Say you rename GostFaceNet.py to whatever.py ... you'd also need to change this accordingly logger = Logger(module="basemodels.GhostFaceNet") otherwise, in case the codes printout a logline with the module name (useful for debugging and asking for support) you might end up with an inconsistent info
Not disagreeing on that. I'm only saying you can get the name of the calling module at runtime even using a singleton instance of the logger. |
I did not disagree. Just thinking out loud. I will play with the logger then. Thank you for your comment and feedback. |
Closed with PR - #1177 |
Just wondering what's the rationale about logger instancing:
module
optional argument even if valued is not considered in any log lineThank you
The text was updated successfully, but these errors were encountered: