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


Python logger.info方法代码示例

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


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

示例1: __call__

# 需要导入模块: from log import logger [as 别名]
# 或者: from log.logger import info [as 别名]
def __call__(self, operation):
        @wraps(operation)
        def wrapped(*args, **kwargs):
            last_raised = None

            for _ in range(self.retries_limit):
                try:
                    return operation(*args, **kwargs)
                except self.allowed_exceptions as e:
                    logger.info(
                        "retrying %s due to %s", operation.__qualname__, e
                    )
                    last_raised = e
            raise last_raised

        return wrapped 
开发者ID:PacktPublishing,项目名称:Clean-Code-in-Python,代码行数:18,代码来源:decorator_parametrized_2.py

示例2: search_nested_bad

# 需要导入模块: from log import logger [as 别名]
# 或者: from log.logger import info [as 别名]
def search_nested_bad(array, desired_value):
    """Example of an iteration in a nested loop."""
    coords = None
    for i, row in enumerate(array):
        for j, cell in enumerate(row):
            if cell == desired_value:
                coords = (i, j)
                break

        if coords is not None:
            break

    if coords is None:
        raise ValueError(f"{desired_value} not found")

    logger.info("value %r found at [%i, %i]", desired_value, *coords)
    return coords 
开发者ID:PacktPublishing,项目名称:Clean-Code-in-Python,代码行数:19,代码来源:generators_pythonic_4.py

示例3: stream_data

# 需要导入模块: from log import logger [as 别名]
# 或者: from log.logger import info [as 别名]
def stream_data(db_handler):
    """Test the ``.throw()`` method.

    >>> streamer = stream_data(DBHandler("testdb"))
    >>> len(next(streamer))
    10
    """
    while True:
        try:
            yield db_handler.read_n_records(10)
        except CustomException as e:
            logger.info("controlled error %r, continuing", e)
        except Exception as e:
            logger.info("unhandled error %r, stopping", e)
            db_handler.close()
            break 
开发者ID:rmariano,项目名称:Clean-code-in-Python,代码行数:18,代码来源:generators_coroutines_1.py

示例4: getLrc

# 需要导入模块: from log import logger [as 别名]
# 或者: from log.logger import info [as 别名]
def getLrc(self, artist, title):
        try:
            if title:
                lrc_path = self.getLrcPath(artist, title)
                if lrc_path and os.path.exists(lrc_path):
                    self.lrcFileExisted.emit(lrc_path)
                else:
                    artist = artist.encode('utf-8')
                    title = title.encode('utf-8')
                    lrc_path = self.multiple_engine(lrc_path, artist, title)
                    if lrc_path:
                        self.lrcFileExisted.emit(lrc_path)
                    else:
                        signalManager.noLrcFound.emit()
        except Exception, e:
            logger.info(e) 
开发者ID:dragondjf,项目名称:QMusic,代码行数:18,代码来源:lrcworker.py

示例5: multiple_engine

# 需要导入模块: from log import logger [as 别名]
# 或者: from log.logger import info [as 别名]
def multiple_engine(self, lrc_path, artist, title):
        try:
            engines = [self.ttPlayerEngine, self.ttPodEngine, self.tingEngine,
                       self.sosoEngine, self.duomiEngine]
            for engine in engines:
                lrcPath = engine(lrc_path, artist, title)
                if lrcPath:
                    return lrcPath
            # signalManager.noLrcFound.emit()
            try:
                os.unlink(lrc_path)
            except:
                pass
            return None
        except Exception, e:
            logger.info(e)
            return None 
开发者ID:dragondjf,项目名称:QMusic,代码行数:19,代码来源:lrcworker.py

示例6: json_to_data_points

# 需要导入模块: from log import logger [as 别名]
# 或者: from log.logger import info [as 别名]
def json_to_data_points(args):
    # datapoints:
    # (region, district, area, table, row, column, value)
    region, district, area, table, filename = args
    datapoints = []
    raw = json.load(open(filename))
    # The first one corresponds to row headers
    raw['column_names'].pop(0)
    for i in range(len(raw['row_names'])):
        row = raw['row_names'][i]
        for j in range(len(raw['column_names'])):
            column = raw['column_names'][j]
            value = raw['data'][i][j]
            dp = (region, district, area, table, row, column, value)
            if is_good_datapoint(*dp):
                datapoints.append(dp)
    logger.info('Add %s values from %s', len(datapoints), filename)
    return datapoints 
开发者ID:gazetteerhk,项目名称:census_explorer,代码行数:20,代码来源:combine_json.py

示例7: run

# 需要导入模块: from log import logger [as 别名]
# 或者: from log.logger import info [as 别名]
def run(self):
        logger.info("Started analyzing file: %s", os.path.basename(self._path_to_sgf))

        self.parse_sgf_file()
        self.cursor = self.sgf_data.cursor()

        try:
            self.prepare()
            self.analyze_main_line()
            self.analyze_variations()

        except KeyboardInterrupt:
            pass

        except:
            logger.exception("Exception during analysis.")
        finally:
            self.bot.stop()

        logger.info("Finished analyzing file: %s", os.path.basename(self._path_to_sgf)) 
开发者ID:jumpman24,项目名称:sgf-analyzer,代码行数:22,代码来源:sgfanalyze.py

示例8: start

# 需要导入模块: from log import logger [as 别名]
# 或者: from log.logger import info [as 别名]
def start(self):
        logger.info("Starting GTP...")

        self.process = Popen([self.executable] + self.arguments,
                             stdout=PIPE,
                             stdin=PIPE,
                             stderr=PIPE,
                             universal_newlines=True)
        sleep(2)
        self.stdout_thread = start_reader_thread(self.process.stdout)
        self.stderr_thread = start_reader_thread(self.process.stderr)

        self.send_command(f'boardsize {self.board_size}')
        self.send_command(f'komi {self.komi}')
        self.send_command(f'time_settings 0 {self.time_per_move} 1')
        logger.info("GTP started successfully.") 
开发者ID:jumpman24,项目名称:sgf-analyzer,代码行数:18,代码来源:bot_engines.py

示例9: merge

# 需要导入模块: from log import logger [as 别名]
# 或者: from log.logger import info [as 别名]
def merge(self):
        logger.info("merging %s", self._merge_request)
        logger.info("deleting branch %s", self._merge_request.source_branch)
        self._merge_request.state = Merged 
开发者ID:PacktPublishing,项目名称:Clean-Code-in-Python,代码行数:6,代码来源:state_1.py

示例10: open

# 需要导入模块: from log import logger [as 别名]
# 或者: from log.logger import info [as 别名]
def open(self):
        logger.info("reopening closed merge request %s", self._merge_request)
        self._merge_request.state = Open 
开发者ID:PacktPublishing,项目名称:Clean-Code-in-Python,代码行数:5,代码来源:state_1.py

示例11: pull

# 需要导入模块: from log import logger [as 别名]
# 或者: from log.logger import info [as 别名]
def pull(self):
        logger.info("pulling from %s", self.current_tag)
        return self.current_tag 
开发者ID:PacktPublishing,项目名称:Clean-Code-in-Python,代码行数:5,代码来源:monostate_1.py

示例12: pull

# 需要导入模块: from log import logger [as 别名]
# 或者: from log.logger import info [as 别名]
def pull(self):
        logger.info("pulling from tag %s", self.source)
        return f"Tag = {self.source}" 
开发者ID:PacktPublishing,项目名称:Clean-Code-in-Python,代码行数:5,代码来源:monostate_4.py

示例13: pull

# 需要导入模块: from log import logger [as 别名]
# 或者: from log.logger import info [as 别名]
def pull(self):
        logger.info("pulling from branch %s", self.source)
        return f"Branch = {self.source}" 
开发者ID:PacktPublishing,项目名称:Clean-Code-in-Python,代码行数:5,代码来源:monostate_3.py

示例14: search

# 需要导入模块: from log import logger [as 别名]
# 或者: from log.logger import info [as 别名]
def search(self, user_namespace):
        logger.info("looking for %s", user_namespace) 
开发者ID:PacktPublishing,项目名称:Clean-Code-in-Python,代码行数:4,代码来源:_adapter_base.py

示例15: operation1

# 需要导入模块: from log import logger [as 别名]
# 或者: from log.logger import info [as 别名]
def operation1():
    time.sleep(2)
    logger.info("running operation 1")
    return 2 
开发者ID:PacktPublishing,项目名称:Clean-Code-in-Python,代码行数:6,代码来源:decorator_SoC_1.py


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