当前位置: 首页>>代码示例>>Python>>正文


Python logger.disable方法代码示例

本文整理汇总了Python中loguru.logger.disable方法的典型用法代码示例。如果您正苦于以下问题:Python logger.disable方法的具体用法?Python logger.disable怎么用?Python logger.disable使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在loguru.logger的用法示例。


在下文中一共展示了logger.disable方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: initialize_logger

# 需要导入模块: from loguru import logger [as 别名]
# 或者: from loguru.logger import disable [as 别名]
def initialize_logger(name: str, log_level: str) -> None:
    logger.remove()

    if log_level == QUIET_LOG_LEVEL:
        logger.disable(name)
        return

    if log_level == "DEBUG":
        log_format = (
            "<level>{level: <8}</level> | "
            "<cyan>{name}</cyan>:<cyan>{function}</cyan>:<cyan>{line}</cyan> - <level>{message}</level>"
        )
    else:
        log_format = "<level>[{level}]</level> {message}"

    logger.add(sys.stdout, colorize=True, format=log_format, level=log_level)
    logger.enable(name)
    ptr.set_logger(True)
    sqlite.set_logger(True)
    appconfigpy.set_logger(True) 
开发者ID:thombashi,项目名称:sqlitebiter,代码行数:22,代码来源:__main__.py

示例2: set_logger

# 需要导入模块: from loguru import logger [as 别名]
# 或者: from loguru.logger import disable [as 别名]
def set_logger(is_enable: bool, propagation_depth: int = 2) -> None:
    if is_enable:
        logger.enable(MODULE_NAME)
    else:
        logger.disable(MODULE_NAME)

    if propagation_depth <= 0:
        return

    tabledata.set_logger(is_enable, propagation_depth - 1)
    sqliteschema.set_logger(is_enable, propagation_depth - 1)

    try:
        import pytablereader

        pytablereader.set_logger(is_enable, propagation_depth - 1)
    except (ImportError, TypeError):
        pass 
开发者ID:thombashi,项目名称:SimpleSQLite,代码行数:20,代码来源:_logger.py

示例3: set_logger

# 需要导入模块: from loguru import logger [as 别名]
# 或者: from loguru.logger import disable [as 别名]
def set_logger(is_enable, propagation_depth=2):
    if is_enable:
        logger.enable(MODULE_NAME)
    else:
        logger.disable(MODULE_NAME)

    if propagation_depth <= 0:
        return

    dataproperty.set_logger(is_enable, propagation_depth - 1)

    try:
        import simplesqlite

        simplesqlite.set_logger(is_enable, propagation_depth - 1)
    except (ImportError, TypeError):
        pass 
开发者ID:thombashi,项目名称:pytablereader,代码行数:19,代码来源:_logger.py

示例4: set_logger

# 需要导入模块: from loguru import logger [as 别名]
# 或者: from loguru.logger import disable [as 别名]
def set_logger(is_enable: bool, propagation_depth: int = 1) -> None:
    if is_enable:
        logger.enable(MODULE_NAME)
    else:
        logger.disable(MODULE_NAME)

    if propagation_depth <= 0:
        return

    dataproperty.set_logger(is_enable, propagation_depth - 1)

    try:
        import simplesqlite

        simplesqlite.set_logger(is_enable, propagation_depth - 1)
    except ImportError:
        pass

    try:
        import pytablereader

        pytablereader.set_logger(is_enable, propagation_depth - 1)
    except ImportError:
        pass 
开发者ID:thombashi,项目名称:pytablewriter,代码行数:26,代码来源:_logger.py

示例5: caplog

# 需要导入模块: from loguru import logger [as 别名]
# 或者: from loguru.logger import disable [as 别名]
def caplog(_caplog):  # noqa: F811
    """A fixture to capture loguru logging messages.

    Copied from https://loguru.readthedocs.io/en/stable/resources/migration.html
    """

    class PropagateHandler(logging.Handler):
        def emit(self, record):
            logging.getLogger(record.name).handle(record)

    logger.enable("charger")
    handler_id = logger.add(PropagateHandler(), format="{message}")
    yield _caplog
    logger.remove(handler_id)
    logger.disable("charger") 
开发者ID:ding-lab,项目名称:CharGer,代码行数:17,代码来源:conftest.py

示例6: setup

# 需要导入模块: from loguru import logger [as 别名]
# 或者: from loguru.logger import disable [as 别名]
def setup():
    logging.basicConfig(handlers=[InterceptHandler()], level=logging.INFO)
    logger.disable("sqlalchemy.engine.base") 
开发者ID:aiogram,项目名称:bot,代码行数:5,代码来源:logging.py

示例7: set_logger

# 需要导入模块: from loguru import logger [as 别名]
# 或者: from loguru.logger import disable [as 别名]
def set_logger(is_enable):
    if is_enable:
        logger.enable(MODULE_NAME)
    else:
        logger.disable(MODULE_NAME)

    simplesqlite.set_logger(is_enable)
    subprocrunner.set_logger(is_enable) 
开发者ID:thombashi,项目名称:tcconfig,代码行数:10,代码来源:_logger.py

示例8: test_disabled_logger_in_sink

# 需要导入模块: from loguru import logger [as 别名]
# 或者: from loguru.logger import disable [as 别名]
def test_disabled_logger_in_sink(sink_with_logger):
    sink = sink_with_logger(logger)
    logger.disable("tests.conftest")
    logger.add(sink, format="{message}")
    logger.info("Disabled test")
    assert sink.out == "Disabled test\n" 
开发者ID:Delgan,项目名称:loguru,代码行数:8,代码来源:test_add_sinks.py

示例9: test_disable

# 需要导入模块: from loguru import logger [as 别名]
# 或者: from loguru.logger import disable [as 别名]
def test_disable(writer, name, should_log):
    logger.add(writer, format="{message}")
    logger.disable(name)
    logger.debug("message")
    result = writer.read()

    if should_log:
        assert result == "message\n"
    else:
        assert result == "" 
开发者ID:Delgan,项目名称:loguru,代码行数:12,代码来源:test_activation.py

示例10: test_enable

# 需要导入模块: from loguru import logger [as 别名]
# 或者: from loguru.logger import disable [as 别名]
def test_enable(writer, name, should_log):
    logger.add(writer, format="{message}")
    logger.disable("")
    logger.enable(name)
    logger.debug("message")
    result = writer.read()

    if should_log:
        assert result == "message\n"
    else:
        assert result == "" 
开发者ID:Delgan,项目名称:loguru,代码行数:13,代码来源:test_activation.py

示例11: test_log_before_enable

# 需要导入模块: from loguru import logger [as 别名]
# 或者: from loguru.logger import disable [as 别名]
def test_log_before_enable(writer):
    logger.add(writer, format="{message}")
    logger.disable("")
    logger.debug("nope")
    logger.enable("tests")
    logger.debug("yes")
    result = writer.read()
    assert result == "yes\n" 
开发者ID:Delgan,项目名称:loguru,代码行数:10,代码来源:test_activation.py

示例12: test_log_before_disable

# 需要导入模块: from loguru import logger [as 别名]
# 或者: from loguru.logger import disable [as 别名]
def test_log_before_disable(writer):
    logger.add(writer, format="{message}")
    logger.enable("")
    logger.debug("yes")
    logger.disable("tests")
    logger.debug("nope")
    result = writer.read()
    assert result == "yes\n" 
开发者ID:Delgan,项目名称:loguru,代码行数:10,代码来源:test_activation.py

示例13: test_log_before_enable_f_globals_name_absent

# 需要导入模块: from loguru import logger [as 别名]
# 或者: from loguru.logger import disable [as 别名]
def test_log_before_enable_f_globals_name_absent(writer, f_globals_name_absent):
    logger.add(writer, format="{message}")
    logger.disable(None)
    logger.debug("nope")
    logger.enable(None)
    logger.debug("yes")
    result = writer.read()
    assert result == "yes\n" 
开发者ID:Delgan,项目名称:loguru,代码行数:10,代码来源:test_activation.py

示例14: test_log_before_disable_f_globals_name_absent

# 需要导入模块: from loguru import logger [as 别名]
# 或者: from loguru.logger import disable [as 别名]
def test_log_before_disable_f_globals_name_absent(writer, f_globals_name_absent):
    logger.add(writer, format="{message}")
    logger.enable(None)
    logger.debug("yes")
    logger.disable(None)
    logger.debug("nope")
    result = writer.read()
    assert result == "yes\n" 
开发者ID:Delgan,项目名称:loguru,代码行数:10,代码来源:test_activation.py

示例15: test_f_globals_name_absent_with_others

# 需要导入模块: from loguru import logger [as 别名]
# 或者: from loguru.logger import disable [as 别名]
def test_f_globals_name_absent_with_others(writer, f_globals_name_absent):
    logger.add(writer, format="{message}")
    logger.info("1")
    logger.enable(None)
    logger.disable("foobar")
    logger.enable("foo.bar")
    logger.disable(None)
    logger.info("2")
    logger.enable("foobar")
    logger.enable(None)
    logger.info("3")
    assert writer.read() == "1\n3\n" 
开发者ID:Delgan,项目名称:loguru,代码行数:14,代码来源:test_activation.py


注:本文中的loguru.logger.disable方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。