args.py 文件源码

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

项目:octodns 作者: github 项目源码 文件源码
def _setup_logging(self, args, default_log_level):
        fmt = '%(asctime)s [%(thread)d] %(levelname)-5s %(name)s %(message)s'
        formatter = Formatter(fmt=fmt, datefmt='%Y-%m-%dT%H:%M:%S ')
        stream = stdout if args.log_stream_stdout else stderr
        handler = StreamHandler(stream=stream)
        handler.setFormatter(formatter)
        logger = getLogger()
        logger.addHandler(handler)

        if args.log_syslog:
            fmt = 'octodns[%(process)-5s:%(thread)d]: %(name)s ' \
                '%(levelname)-5s %(message)s'
            handler = SysLogHandler(address=args.syslog_device,
                                    facility=args.syslog_facility)
            handler.setFormatter(Formatter(fmt=fmt))
            logger.addHandler(handler)

        logger.level = DEBUG if args.debug else default_log_level

        # boto is noisy, set it to warn
        getLogger('botocore').level = WARN
        # DynectSession is noisy too
        getLogger('DynectSession').level = WARN
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号