I have a class that creates a self.logger (self.logger = logging.getLogger(str(uuid.uuid4()))) with a unique id in order to avoid my loggers to be mixed when multiple API calls are creating class instances at the same time. However, I have another file with my utility functions that do not belong to the class, and those functions are supposed to produce logs too. My question is : how to I make those functions use the same logger without having to give them the id of the main logger as an argument ? Is there a way to tell a logger created in a function to use the parent logger ?
In my utility file, since I don't want to pass the logger as argument to all the functions, I simply do a logging.info to create new logs, but it is using the root logger.