-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Update Logger singleton creation, add test and docstring #1291
Conversation
.gitignore
Outdated
@@ -6,6 +6,7 @@ Pipfile | |||
Pipfile.lock | |||
.mypy_cache/ | |||
.idea/ | |||
.vscode/ |
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.
this should not be added to gitignore because it stores the configuration all developers should follow.
i can update source code from different environments with same auto-linting in that way.
please remove it.
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 understand the importance of consistent configurations across different environments.
But I think keeping the .vscode
folder in the repository can lead to 2 potential issues:
- The .vscode folder often contains individual developer settings, which might conflict with personal preferences or setups.
- Sometimes,
.vscode/*
files may include sensitive information specific to a developer's local environment.
To achieve consistency, it is possible to save essential settings in .vscode/settings.json
while ignoring other files from this folder.
Let me know your thoughts!
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.
current .vscode in the source code does not have any sensitive information. still thinking it is important to have it.
In previous design, we can either create a singleton logger and standalone logger. in case of creating standalone one, module is being set and this can be printed in the log messages. With this design, logger must be singleton. How can be highlighted the triggered module? ps: not a negative comment, just to discuss |
I haven't seen the |
@kremnik never mind the stand alone thing. That feature is available but not being used at all. It is good to go if you restore vscode folder. |
Thank you for your contribution |
What has been done
With this PR, just made a few tweaks to the way we create the singleton instance of the Logger class.
Logger
's__new__
method.get_singletonish_logger()
has been replaced with a simple instantiation by callingLogger()
.test_singleton.py
) has been added to verify that the created instances have the same memory address..vscode
folder has been added to.gitignore
.How to test
or if you want to test singleton creation only: