I've multiple instanciated logger classes in logger.py
which I import in multiple other modules.
logger.py
class Logger:
def __init__(self, name='default'):
# create a Logger with custom handlers
# ...
main_logger = Logger('main_logger')
another_topic_logger = Logger('another_topic_logger')
module_a.py
from logger import main_logger
main_logger.info('hello!')
How does Python handle it in the background? Do I need a Singleton wrapper or is that just fine?
Aucun commentaire:
Enregistrer un commentaire