-
-
Notifications
You must be signed in to change notification settings - Fork 99
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
importing Heyoo is messing logging configuration #56
Comments
Hey @rbarcelos Can you please explain more about the issue with current logging and the your suggestion to fixing it ? |
Disclaimer: I just started playing with Python so no guarantees that my guidance is correct.. Looking at your code (iniit.py), given the way that you are setting up logging, it will be called as soon as I import your module. For some reason, calling logging.basicConfig with my configs after that wont update it. One possible fix: make logging an optional parameter on WhatsApp ctor. So consumers can passe their instance instead of you creating yours. It aligns with the dependency injection pattern |
I tried to look into this a little and find some best practices. https://docs.python.org/3/howto/logging.html#configuring-logging-for-a-library |
I see |
Resolved by #71 |
heyoo messes up logging init and it needs to be placed after basicConfig statement as fol;owing:
from flask_executor import Executor
LOG_FILE_NAME = "service.log"
logging.basicConfig(
level=logging.DEBUG,
filename=LOG_FILE_NAME,
filemode="a+",
format="%(asctime)-15s %(levelname)-8s %(message)s",
)
// Unfortunately heyoo messes up logging init, needs to be placed after basicConfig statement
from heyoo import
WhatsApp # pylint: disable=wrong-import-position, wrong-import-order
The text was updated successfully, but these errors were encountered: