Python coloredlogs.DEFAULT_LOG_FORMAT Examples
The following are 2
code examples of coloredlogs.DEFAULT_LOG_FORMAT().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
coloredlogs
, or try the search function
.
Example #1
Source File: __init__.py From aetros-cli with MIT License | 6 votes |
def get_logger(name='', debug=None, format=None): import coloredlogs # logging.basicConfig() # this will make paramiko log a lot of stuff logger = logging.getLogger(name if name else 'aetros') level = 'INFO' fmt = '%(message)s' if format is None else format if debug is None: debug = is_debug() if debug: level = 'DEBUG' if format is None: fmt = coloredlogs.DEFAULT_LOG_FORMAT atty = None if '1' == os.getenv('AETROS_ATTY'): atty = True coloredlogs.install(fmt=fmt, level=level, logger=logger, isatty=atty) return logger
Example #2
Source File: logger_manager.py From iris with Mozilla Public License 2.0 | 6 votes |
def set_log_format(): if core_args.level < 20: log_format = "%(asctime)s [%(levelname)s] %(message)s" coloredlogs.DEFAULT_LOG_FORMAT = log_format coloredlogs.DEFAULT_FIELD_STYLES = { "levelname": {"color": "cyan", "bold": True} } coloredlogs.DEFAULT_LEVEL_STYLES = { "warning": {"color": "yellow", "bold": True}, "success": {"color": "green", "bold": True}, "error": {"color": "red", "bold": True}, } else: log_format = "%(message)s" coloredlogs.DEFAULT_LOG_FORMAT = log_format coloredlogs.DEFAULT_LEVEL_STYLES = { "warning": {"color": "yellow", "bold": True}, "success": {"color": "green", "bold": True}, "error": {"color": "red", "bold": True}, } return log_format