log.py 文件源码

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

项目:TCP-IP 作者: JackZ0 项目源码 文件源码
def pre_arg_parse_except_hook(memory_handler, *args, **kwargs):
    """A simple wrapper around post_arg_parse_except_hook.

    The additional functionality provided by this wrapper is the memory
    handler will be flushed before Certbot exits. This allows us to
    write logging messages to a temporary file if we crashed before
    logging was fully configured.

    Since sys.excepthook isn't called on SystemExit exceptions, the
    memory handler will not be flushed in this case which prevents us
    from creating temporary log files when argparse exits because a
    command line argument was invalid or -h, --help, or --version was
    provided on the command line.

    :param MemoryHandler memory_handler: memory handler to flush
    :param tuple args: args for post_arg_parse_except_hook
    :param dict kwargs: kwargs for post_arg_parse_except_hook

    """
    try:
        post_arg_parse_except_hook(*args, **kwargs)
    finally:
        # flush() is called here so messages logged during
        # post_arg_parse_except_hook are also flushed.
        memory_handler.flush(force=True)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号