Created
January 9, 2019 10:15
-
-
Save jmetzz/d324e90a7af38a6589f462cf8064ef45 to your computer and use it in GitHub Desktop.
python color log configuration
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 configure_colored_logging(loglevel): | |
import coloredlogs | |
field_styles = coloredlogs.DEFAULT_FIELD_STYLES.copy() | |
field_styles['asctime'] = {} | |
level_styles = coloredlogs.DEFAULT_LEVEL_STYLES.copy() | |
level_styles['debug'] = {} | |
coloredlogs.install( | |
level=loglevel, | |
use_chroot=False, | |
fmt='%(asctime)s %(levelname)-8s %(name)s - %(message)s', | |
level_styles=level_styles, | |
field_styles=field_styles) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment