Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
record.msg = '{}[INFO]{}: '.format(
Err_Style.BRIGHT, Err_Style.RESET_ALL) + record.msg
else:
record.msg = '{}{}[DEBUG]{}{}: '.format(
Err_Style.BRIGHT, Err_Fore.LIGHTBLACK_EX, Err_Fore.RESET,
Err_Style.RESET_ALL) + record.msg
return super(LevelDifferentiatingFormatter, self).format(record)
logger = logging.getLogger('p4a')
if not hasattr(logger, 'touched'): # Necessary as importlib reloads
# this, which would add a second
# handler and reset the level
logger.setLevel(logging.INFO)
logger.touched = True
ch = logging.StreamHandler(stderr)
formatter = LevelDifferentiatingFormatter('%(message)s')
ch.setFormatter(formatter)
logger.addHandler(ch)
info = logger.info
debug = logger.debug
warning = logger.warning
error = logger.error
class colorama_shim(object):
def __init__(self, real):
self._dict = defaultdict(str)
self._real = real
self._enabled = False
def __getattr__(self, key):
record.msg = '{}[INFO]{}: '.format(
Err_Style.BRIGHT, Err_Style.RESET_ALL) + record.msg
else:
record.msg = '{}{}[DEBUG]{}{}: '.format(
Err_Style.BRIGHT, Err_Fore.LIGHTBLACK_EX, Err_Fore.RESET,
Err_Style.RESET_ALL) + record.msg
return super(LevelDifferentiatingFormatter, self).format(record)
logger = logging.getLogger('p4a')
if not hasattr(logger, 'touched'): # Necessary as importlib reloads
# this, which would add a second
# handler and reset the level
logger.setLevel(logging.INFO)
logger.touched = True
ch = logging.StreamHandler(stderr)
formatter = LevelDifferentiatingFormatter('%(message)s')
ch.setFormatter(formatter)
logger.addHandler(ch)
info = logger.info
debug = logger.debug
warning = logger.warning
error = logger.error
class colorama_shim(object):
def __init__(self, real):
self._dict = defaultdict(str)
self._real = real
self._enabled = False
def __getattr__(self, key):
if record.levelno > 30:
record.msg = '{}{}[ERROR]{}{}: '.format(
Err_Style.BRIGHT, Err_Fore.RED, Err_Fore.RESET,
Err_Style.RESET_ALL) + record.msg
elif record.levelno > 20:
record.msg = '{}{}[WARNING]{}{}: '.format(
Err_Style.BRIGHT, Err_Fore.RED, Err_Fore.RESET,
Err_Style.RESET_ALL) + record.msg
elif record.levelno > 10:
record.msg = '{}[INFO]{}: '.format(
Err_Style.BRIGHT, Err_Style.RESET_ALL) + record.msg
else:
record.msg = '{}{}[DEBUG]{}{}: '.format(
Err_Style.BRIGHT, Err_Fore.LIGHTBLACK_EX, Err_Fore.RESET,
Err_Style.RESET_ALL) + record.msg
return super(LevelDifferentiatingFormatter, self).format(record)
if record.levelno > 30:
record.msg = '{}{}[ERROR]{}{}: '.format(
Err_Style.BRIGHT, Err_Fore.RED, Err_Fore.RESET,
Err_Style.RESET_ALL) + record.msg
elif record.levelno > 20:
record.msg = '{}{}[WARNING]{}{}: '.format(
Err_Style.BRIGHT, Err_Fore.RED, Err_Fore.RESET,
Err_Style.RESET_ALL) + record.msg
elif record.levelno > 10:
record.msg = '{}[INFO]{}: '.format(
Err_Style.BRIGHT, Err_Style.RESET_ALL) + record.msg
else:
record.msg = '{}{}[DEBUG]{}{}: '.format(
Err_Style.BRIGHT, Err_Fore.LIGHTBLACK_EX, Err_Fore.RESET,
Err_Style.RESET_ALL) + record.msg
return super(LevelDifferentiatingFormatter, self).format(record)