It seems that logging is not that easy to use in Python. For example, I need to use logging for logs, and I also need to import other stuff from some other packages.
If I write my code like below:
import logging
import foo
from bar import baz
logging.basicConfig(...)
the logs will not output as I configured in basicConfig(), they will be output in the default format. So the basicConfig() doesn't work in this case.
If I write my code like below:
import logging
logging.basicConfig(...)
import foo
from bar import baz
The logs will be output as I configured in basicConfig(), but the code style does not obey PEP8, because logging.basicConfig() appears among the import statements.
Is there any solution for it so that I can have it both ways?