(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["formatters"]["keys"]
    if not len(flist):
        return {}
    flist = flist.split(",")
    flist = _strip_spaces(flist)
    formatters = {}
    for form in flist:
        sectname = "formatter_%s" % form
        fs = cp.get(sectname, "format", raw=True, fallback=None)
        dfs = cp.get(sectname, "datefmt", raw=True, fallback=None)
        stl = cp.get(sectname, "style", raw=True, fallback='%')
        c = logging.Formatter
        class_name = cp[sectname].get("class")
        if class_name:
            c = _resolve(class_name)
        f = c(fs, dfs, stl)
        formatters[form] = f
    return formatters
def _create_formatters ( cp ) : flist = cp [ "formatters" ] [ "keys" ] if not len ( flist ) : return { } flist = flist . split ( "," ) flist = _strip_spaces ( flist ) formatters = { } for form in flist : sectname = "formatter_%s" % form fs = cp . get ( sectname , "format" , raw = True , fallback = None ) dfs = cp . get ( sectname , "datefmt" , raw = True , fallback = None ) stl = cp . get ( sectname , "style" , raw = True , fallback = '%' ) c = logging . Formatter class_name = cp [ sectname ] . get ( "class" ) if class_name : c = _resolve ( class_name ) f = c ( fs , dfs , stl ) formatters [ form ] = f return formatters