loggingTools.py 文件源码

python
阅读 37 收藏 0 点赞 0 评论 0

项目:otRebuilder 作者: Pal3love 项目源码 文件源码
def __init__(self, fmt=None, datefmt=None, style="%"):
        if style != '%':
            raise ValueError(
                "only '%' percent style is supported in both python 2 and 3")
        if fmt is None:
            fmt = DEFAULT_FORMATS
        if isinstance(fmt, basestring):
            default_format = fmt
            custom_formats = {}
        elif isinstance(fmt, collections.Mapping):
            custom_formats = dict(fmt)
            default_format = custom_formats.pop("*", None)
        else:
            raise TypeError('fmt must be a str or a dict of str: %r' % fmt)
        super(LevelFormatter, self).__init__(default_format, datefmt)
        self.default_format = self._fmt
        self.custom_formats = {}
        for level, fmt in custom_formats.items():
            level = logging._checkLevel(level)
            self.custom_formats[level] = fmt
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号