import logging logger = logging.getLogger(__name__) logger.setLevel(logging.ERROR) handler = logging.StreamHandler() handler.setLevel(logging.ERROR) logger.addHandler(handler)