I want to create a wrapper for python logger that will allow a config file to be loaded internally by the wrapper class. We have quite a large library and are looking to enforce this policy across any modules that are developed with minimal lines of code for dependancies.
import logging
import logging.config
class Log:
file = "/path/to/logging.conf"
def __init__(self,name):
logging.config.fileConfig(self.file)
self.l = logger.getLogger(name)
def warn(...):
....
Instantiation would then be
import log
...
l = log.log(__name__)
l.info("Something happened")
Is this the best way to wrap the logging class or is there a better way?