Created
November 19, 2020 16:05
-
-
Save MatthewRalston/d9c18731ec4991a8058474686a22b7af to your computer and use it in GitHub Desktop.
Root_logger boto update
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def get_root_logger(level): | |
levels=[logging.WARNING, logging.INFO, logging.DEBUG] | |
if level < 0 or level > 2: | |
raise TypeError("{0}.get_root_logger expects a verbosity between 0-2".format(__file__)) | |
logging.basicConfig(level=levels[level], format="%(levelname)s: $(asctime)s %(funcName)s L%(lineno)s| %(message)s", datefmt="%Y/%m/%d %I:%M:%S") | |
root_logger = logging.getLogger(__name__) | |
for name in logging.Logger.manager.loggerDict.keys(): | |
if ('boto' in name) or ('urllib3' in name) or ('s3' in name): | |
logging.getLogger(name).setLevel(logging.ERROR) | |
return root_logger |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment