Created
January 15, 2018 22:08
-
-
Save Tejadogiparthi/d168213f34de7af58dd20c66e4cc96d4 to your computer and use it in GitHub Desktop.
Setup log in aws lambda function.
This file contains hidden or 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 setup_logging(): | |
logger = logging.getLogger() | |
for h in logger.handlers: | |
logger.removeHandler(h) | |
h = logging.StreamHandler(sys.stdout) | |
logformat = '%(asctime)s - %(name)s - %(levelname)s - %(message)s' | |
h.setFormatter(logging.Formatter(logformat)) | |
logger.addHandler(h) | |
logger.setLevel(logging.INFO) | |
return logger |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment