(lvl)
return LOG_LEVEL_MAP.get(lvl, logging.INFO)
Map log levels to strings
Map log levels to strings
Map log levels to strings
def _get_py_loglevel(lvl):
    """
    Map log levels to strings
    """
    # In Python2, transform the unicode object into plain string
    if PY2 and isinstance(lvl, text_type):
        lvl = lvl.encode('ascii', 'ignore')

    # Be resilient to bad input since `lvl` comes from a configuration file
    try:
        lvl = lvl.upper()
    except AttributeError:
        lvl = ''

    # if `lvl` is not a valid level string, let it fall back to default logging value
    return LOG_LEVEL_MAP.get(lvl, logging.INFO)
def _get_py_loglevel ( lvl ) : # In Python2, transform the unicode object into plain string if PY2 and isinstance ( lvl , text_type ) : lvl = lvl . encode ( 'ascii' , 'ignore' ) # Be resilient to bad input since `lvl` comes from a configuration file try : lvl = lvl . upper ( ) except AttributeError : lvl = '' # if `lvl` is not a valid level string, let it fall back to default logging value return LOG_LEVEL_MAP . get ( lvl , logging . INFO )