Created
January 22, 2020 18:11
-
-
Save luminoso/6ceaf04d079018edf59136d2aa365ec3 to your computer and use it in GitHub Desktop.
python logging init
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
import logging | |
# level=logging._nameToLevel[verbosity_level] | |
# level=logging.DEBUG | |
# format="%(asctime)s [%(module)-12.12s] [%(levelname)-5.5s] %(message)s", | |
logging.basicConfig( | |
level=logging.DEBUG, | |
format="%(asctime)s [%(levelname)-5.5s] %(message)s", | |
handlers=[ | |
logging.StreamHandler(), | |
logging.FileHandler(f"./python_run.log"), | |
]) | |
logging.info(f"Set verbosity to {logging.getLevelName(logging.getLogger().getEffectiveLevel())}") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment