Python best way to setup global logger and set the …
https://stackoverflow.com/questions/51412465/python-best-way-to-setup-global-logger-and-set-the-logging-level-from-command-li
Jul 18, 2018 · class MyClass: def __init__(self, log_level=logging.INFO): # you can just setup a class logger like this, and pass in the log level? self.log = logging.getlogger("My Class") self.log.setLevel(log_level) # Will print a message with "My Module" LOG.info('Message from global logger!') # Will print a message with "My Class" self.log.info('Message from class logger!') Reviews: 2
Reviews: 2
DA: 78 PA: 2 MOZ Rank: 34