當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。