def getLogLevelNo(level):
    """Return numerical log level or raise ValueError.

    A valid level is either an integer or a string such as WARNING etc."""
    if isinstance(level,(int,long)):
        return level
    try:
        return(int(logging.getLevelName(level.upper())))
    except:
        raise ValueError('illegal loglevel %s' % level)
def getLogLevelNo ( level ) : if isinstance ( level , ( int , long ) ) : return level try : return ( int ( logging . getLevelName ( level . upper ( ) ) ) ) except : raise ValueError ( 'illegal loglevel %s' % level )
Return numerical log level or raise ValueError.

    A valid level is either an integer or a string such as WARNING etc.