def get_logger(name: str) -> logging.Logger: """ Get a logger for the current module/class :param name: The name of the logger - this appears in the logs :return: Logger instance to store """ logger = logging.getLogger(name) console_logger = logging.StreamHandler() console_logger.setFormatter(LogFormatter()) console_logger.setLevel(logging.WARNING) if ArgHandler.get_verbose(): console_logger.setLevel(logging.INFO) elif ArgHandler.get_very_verbose(): console_logger.setLevel(logging.DEBUG) logger.addHandler(console_logger) logger.debug("New logger created: {NAME}".format(NAME=name)) return logger
def test_get_very_verbose_none(): ArgHandler.parse_arguments(["-T", "127.0.0.1", "-v"]) assert ArgHandler.get_very_verbose() is False