'Parses error level and returns error level enumeration. If
unparsable, returns \'fatal\''

def parse_error_level(self, err_level):

    from galaxy.jobs.error_level import StdioErrorLevel
    return_level = StdioErrorLevel.FATAL
    try:
        if err_level:
            if re.search('log', err_level, re.IGNORECASE):
                return_level = StdioErrorLevel.LOG
            elif re.search('warning', err_level, re.IGNORECASE):
                return_level = StdioErrorLevel.WARNING
            elif re.search('fatal', err_level, re.IGNORECASE):
                return_level = StdioErrorLevel.FATAL
            else:
                log.debug(('Tool    %s:    error    level    %s    did    not    match    log/warning/fatal' % (self.id, err_level)))
    except Exception:
        log.error(('Exception    in    parse_error_level    ' + str(sys.exc_info())))
        trace = sys.exc_info()[2]
        if (trace is not None):
            trace_msg = repr(traceback.format_tb(trace))
            log.error(('Traceback:    %s' % trace_msg))
    return return_level
