(cp)
return formatters
Create and return formatters
Create and return formatters
Create and return formatters
def _create_formatters(cp):
    """Create and return formatters"""
    flist = cp.get("formatters", "keys")
    if not len(flist):
        return {}
    flist = flist.split(",")
    flist = _strip_spaces(flist)
    formatters = {}
    for form in flist:
        sectname = "formatter_%s" % form
        opts = cp.options(sectname)
        if "format" in opts:
            fs = cp.get(sectname, "format", 1)
        else:
            fs = None
        if "datefmt" in opts:
            dfs = cp.get(sectname, "datefmt", 1)
        else:
            dfs = None
        c = logging.Formatter
        if "class" in opts:
            class_name = cp.get(sectname, "class")
            if class_name:
                c = _resolve(class_name)
        f = c(fs, dfs)
        formatters[form] = f
    return formatters
def _create_formatters ( cp ) : flist = cp . get ( "formatters" , "keys" ) if not len ( flist ) : return { } flist = flist . split ( "," ) flist = _strip_spaces ( flist ) formatters = { } for form in flist : sectname = "formatter_%s" % form opts = cp . options ( sectname ) if "format" in opts : fs = cp . get ( sectname , "format" , 1 ) else : fs = None if "datefmt" in opts : dfs = cp . get ( sectname , "datefmt" , 1 ) else : dfs = None c = logging . Formatter if "class" in opts : class_name = cp . get ( sectname , "class" ) if class_name : c = _resolve ( class_name ) f = c ( fs , dfs ) formatters [ form ] = f return formatters