Last active
April 13, 2021 02:31
-
-
Save nijave/f2d5d02a4e7d63c979998839057b1c78 to your computer and use it in GitHub Desktop.
Python logger setup (with alternate format)
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
| import logging | |
| import os | |
| log = logging.getLogger(__file__ if __name__ == "__main__" else __name__) | |
| logging.basicConfig( | |
| level=getattr(logging, os.environ.get("LOG_LEVEL", "INFO").upper()), | |
| format="%(asctime)s [%(levelname)s]: %(message)s", | |
| datefmt="%Y-%m-%dT%H:%M:%S%z", | |
| ) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment