def set_logger(is_enable): if not LOGBOOK_INSTALLED: return if is_enable != logger.disabled: # logger setting have not changed return if is_enable: try: logger.enable() except AttributeError: logger.disabled = False # to support Logbook<1.0.0 else: _disable_logger(logger) dataproperty.set_logger(is_enable) try: import simplesqlite simplesqlite.set_logger(is_enable) except ImportError: pass try: import pytablereader pytablereader.set_logger(is_enable) except ImportError: pass
def set_logger(is_enable): if not LOGBOOK_INSTALLED: return if is_enable != logger.disabled: # logger setting have not changed return if is_enable: logger.enable() else: logger.disable() dataproperty.set_logger(is_enable) try: import simplesqlite simplesqlite.set_logger(is_enable) except ImportError: pass try: import pytablereader pytablereader.set_logger(is_enable) except ImportError: pass
def set_logger(is_enable): if not LOGBOOK_INSTALLED: return if is_enable != logger.disabled: # logger setting have not changed return if is_enable: logger.enable() else: logger.disable() dataproperty.set_logger(is_enable) try: import simplesqlite simplesqlite.set_logger(is_enable) except ImportError: pass try: import pytablereader pytablereader.set_logger(is_enable) except ImportError: pass
def set_logger(is_enable): if is_enable != logger.disabled: return if is_enable: logger.enable() else: logger.disable() dataproperty.set_logger(is_enable) pytablereader.set_logger(is_enable)
def set_logger(is_enable): if is_enable != logger.disabled: return if is_enable: logger.enable() else: logger.disable() dataproperty.set_logger(is_enable) pytablereader.set_logger(is_enable)
def set_logger(is_enable): if is_enable != logger.disabled: return if is_enable: logger.enable() else: logger.disable() dataproperty.set_logger(is_enable) simplesqlite.set_logger(is_enable) try: import pytablereader pytablereader.set_logger(is_enable) except ImportError: pass
def initialize_logger(name: str, log_level: int) -> 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)
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
def test_smoke(self, value): set_logger(value)
def test_smoke(self, value, monkeypatch): monkeypatch.setattr("pytablereader._logger._logger.logger", NullLogger()) set_logger(value)