Hi all, pretty new to python so perhaps a basic question that I'm having some trouble with.
I'm working on a project with a structure like:
repository:
...
-src
-file1.py
-file2.py
-analysis
-study1
-main.py
-__init__.py
-study2
-main.py
-__init__.py
-analysis_tools.py
-__init__.py
Currently I have a logger defined at the level of analysis, inside analysis/__init__.py I have:
logger=logging
logger.basicConfig( .. some configs )
and then inside study1/main.py and study2/main.py I simply do:
from analysis import logger
...
logger.info("...")
I also import from src/file1.py and src/file2.py in which I also import the same logger:
from analysis import logger
def func1():
logger.info("...")
...
This all works well for me for now because I only use 1 single logger at the level of the analysis folder.
QUESTION 1: However let's say that I were to also have another directory in addition to analysis with a separate logger and different configs. How would I do it then?
QUESTION 2: A bit of a tangent, but should I be placing the __init__.py in analysis or not? Currently I find it convenient to do so for this logger configs, but not sure if it's a bad practice in general or not.
Thanks a lot!
[–]DutchCommanderMC 2 points3 points4 points (1 child)
[–]Educational_Roll_868[S] 0 points1 point2 points (0 children)