base.py 文件源码

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

项目:opyrant 作者: opyrant 项目源码 文件源码
def configure_logging(self, level=logging.INFO, debug=False):
        """ Configures the basic logging for the experiment. This creates a handler for logging to the console, sets it at the appropriate level (info by default unless overridden in the config file or by the debug flag) and creates the default formatting for log messages.
        """

        if debug is True:
            self.log_level = logging.DEBUG
        else:
            self.log_level = level

        sys.excepthook = _log_except_hook  # send uncaught exceptions to file

        logging.basicConfig(
            level=self.log_level,
            format='"%(asctime)s","%(levelname)s","%(message)s"'
            )

        # Make sure that the stream handler has the requested log level.
        root_logger = logging.getLogger()
        for handler in root_logger.handlers:
            if isinstance(handler, logging.StreamHandler):
                handler.setLevel(self.log_level)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号