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


Python logger.info方法代码示例

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


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

示例1: test_cli

# 需要导入模块: from loguru import logger [as 别名]
# 或者: from loguru.logger import info [as 别名]
def test_cli():
    logger.info("checking main")
    subprocess.check_call(["python", "-m", "stagesepx.cli"])

    logger.info("checking one_step ...")
    subprocess.check_call(["stagesepx", "one_step", VIDEO_PATH])
    subprocess.check_call(["stagesepx", "one_step", VIDEO_PATH, "output"])

    logger.info("checking keras trainer ...")
    subprocess.check_call(["stagesepx", "train", "output", "output.h5"])
    # try to train
    subprocess.check_call(
        ["stagesepx", "train", "output", "output.h5", "--epochs", "1"]
    )

    # new
    subprocess.check_call(["stagesepx", "analyse", VIDEO_PATH, "output"])
    shutil.rmtree("output") 
开发者ID:williamfzc,项目名称:stagesepx,代码行数:20,代码来源:test_cli.py

示例2: load_frames

# 需要导入模块: from loguru import logger [as 别名]
# 或者: from loguru.logger import info [as 别名]
def load_frames(self):
        # TODO full frames list can be very huge, for some devices
        logger.info(f"start loading {self.path} to memory ...")

        data: typing.List[VideoFrame] = []
        with toolbox.video_capture(self.path) as cap:
            success, frame = cap.read()
            while success:
                frame_object = VideoFrame.init(cap, frame)
                data.append(frame_object)
                success, frame = cap.read()

        # calculate memory cost
        each_cost = data[0].data.nbytes
        logger.debug(f"single frame cost: {each_cost} bytes")
        total_cost = each_cost * self.frame_count
        logger.debug(f"total frame cost: {total_cost} bytes")
        logger.info(
            f"frames loaded. frame count: {self.frame_count}. memory cost: {total_cost} bytes"
        )

        # lock the order
        self.data = tuple(data)
        # fix the length ( the last frame may be broken sometimes )
        self.frame_count = len(data) 
开发者ID:williamfzc,项目名称:stagesepx,代码行数:27,代码来源:video.py

示例3: write

# 需要导入模块: from loguru import logger [as 别名]
# 或者: from loguru.logger import info [as 别名]
def write(self,msg,level='info'):
        "Write out a message"
        fname = inspect.stack()[2][3] #May be use a entry-exit decorator instead        
        d = {'caller_func': fname}                    
        if level.lower()== 'debug': 
            logger.debug("{module} | {msg}",module=d['caller_func'],msg=msg)                      
        elif level.lower()== 'info':
            logger.info("{module} | {msg}",module=d['caller_func'],msg=msg)           
        elif level.lower()== 'warn' or level.lower()=='warning':           
            logger.warning("{module} | {msg}",module=d['caller_func'],msg=msg)
        elif level.lower()== 'error':
            logger.error("{module} | {msg}",module=d['caller_func'],msg=msg)            
        elif level.lower()== 'critical':   
            logger.critical("{module} | {msg}",module=d['caller_func'],msg=msg)            
        else:
            logger.critical("Unknown level passed for the msg: {}", msg) 
开发者ID:qxf2,项目名称:makemework,代码行数:18,代码来源:Base_Logging.py

示例4: release

# 需要导入模块: from loguru import logger [as 别名]
# 或者: from loguru.logger import info [as 别名]
def release(self):
        """Create a zipfile release with the current version number defined in bl_info dict in __init__.py"""
        # Builds dir
        builds = Path('.', 'builds')
        if not builds.exists():
            builds.mkdir()

        # Extract the version number from the __init__.py file.
        regex = r"\"version\":\s*(\(\d\,\s*\d\,\s*\d\))"
        with Path('__init__.py').open('r') as f:
            string = f.read().replace("\n", '')
            match = re.findall(regex, string, re.MULTILINE)[0]
            log.debug(match)
            log.info(f'Create release version: {match}')
        postfix = '.'.join([str(x) for x in eval(match)])

        # Zip all needed file into a realease.
        zip_file = builds / f'Projectors {postfix}.zip'
        with zipfile.ZipFile(zip_file, 'w') as zf:
            for f in Path('.').glob('*.py'):
                zf.write(f)
            zf.write('README.md')
            zf.write('LICENSE')
        return f'A realease zipfile was created: {zip_file}' 
开发者ID:Ocupe,项目名称:Projectors,代码行数:26,代码来源:cmd.py

示例5: format_pytest_with_black

# 需要导入模块: from loguru import logger [as 别名]
# 或者: from loguru.logger import info [as 别名]
def format_pytest_with_black(*python_paths: Text) -> NoReturn:
    logger.info("format pytest cases with black ...")
    try:
        if is_support_multiprocessing() or len(python_paths) <= 1:
            subprocess.run(["black", *python_paths])
        else:
            logger.warning(
                f"this system does not support multiprocessing well, format files one by one ..."
            )
            [subprocess.run(["black", path]) for path in python_paths]
    except subprocess.CalledProcessError as ex:
        capture_exception(ex)
        logger.error(ex)
        sys.exit(1)
    except FileNotFoundError:
        err_msg = """
missing dependency tool: black
install black manually and try again:
$ pip install black
"""
        logger.error(err_msg)
        sys.exit(1) 
开发者ID:httprunner,项目名称:httprunner,代码行数:24,代码来源:make.py

示例6: __run_step

# 需要导入模块: from loguru import logger [as 别名]
# 或者: from loguru.logger import info [as 别名]
def __run_step(self, step: TStep) -> Dict:
        """run teststep, teststep maybe a request or referenced testcase"""
        logger.info(f"run step begin: {step.name} >>>>>>")

        if step.request:
            step_data = self.__run_step_request(step)
        elif step.testcase:
            step_data = self.__run_step_testcase(step)
        else:
            raise ParamsError(
                f"teststep is neither a request nor a referenced testcase: {step.dict()}"
            )

        self.__step_datas.append(step_data)
        logger.info(f"run step end: {step.name} <<<<<<\n")
        return step_data.export_vars 
开发者ID:httprunner,项目名称:httprunner,代码行数:18,代码来源:runner.py

示例7: ensure_testcase_v3_api

# 需要导入模块: from loguru import logger [as 别名]
# 或者: from loguru.logger import info [as 别名]
def ensure_testcase_v3_api(api_content: Dict) -> Dict:
    logger.info("convert api in v2 to testcase format v3")

    teststep = {
        "request": _sort_request_by_custom_order(api_content["request"]),
    }
    teststep.update(_ensure_step_attachment(api_content))

    teststep = _sort_step_by_custom_order(teststep)

    config = {"name": api_content["name"]}
    extract_variable_names: List = list(teststep.get("extract", {}).keys())
    if extract_variable_names:
        config["export"] = extract_variable_names

    return {
        "config": config,
        "teststeps": [teststep],
    } 
开发者ID:httprunner,项目名称:httprunner,代码行数:21,代码来源:compat.py

示例8: gen_testcase

# 需要导入模块: from loguru import logger [as 别名]
# 或者: from loguru.logger import info [as 别名]
def gen_testcase(self, file_type="pytest"):
        logger.info(f"Start to generate testcase from {self.har_file_path}")
        harfile = os.path.splitext(self.har_file_path)[0]

        try:
            testcase = self._make_testcase()
        except Exception as ex:
            capture_exception(ex)
            raise

        if file_type == "JSON":
            output_testcase_file = f"{harfile}.json"
            utils.dump_json(testcase, output_testcase_file)
        elif file_type == "YAML":
            output_testcase_file = f"{harfile}.yml"
            utils.dump_yaml(testcase, output_testcase_file)
        else:
            # default to generate pytest file
            testcase["config"]["path"] = self.har_file_path
            output_testcase_file = make_testcase(testcase)
            format_pytest_with_black(output_testcase_file)

        logger.info(f"generated testcase: {output_testcase_file}") 
开发者ID:httprunner,项目名称:httprunner,代码行数:25,代码来源:core.py

示例9: cycle

# 需要导入模块: from loguru import logger [as 别名]
# 或者: from loguru.logger import info [as 别名]
def cycle(dataloader, device, start_iteration: int = 0):
    r"""
    A generator to yield batches of data from dataloader infinitely.

    Internally, it sets the ``epoch`` for dataloader sampler to shuffle the
    examples. One may optionally provide the starting iteration to make sure
    the shuffling seed is different and continues naturally.
    """
    iteration = start_iteration

    while True:
        # Set the `epoch` of sampler as current iteration. This is just for
        # determinisitic shuffling after every epoch, so it is just a seed and
        # need not necessarily be the "epoch".
        logger.info(f"Beginning new epoch, setting shuffle seed {iteration}")
        dataloader.sampler.set_epoch(iteration)

        for batch in dataloader:
            for key in batch:
                batch[key] = batch[key].to(device)
            yield batch
            iteration += 1 
开发者ID:kdexd,项目名称:virtex,代码行数:24,代码来源:common.py

示例10: _read_pp2_gene_list

# 需要导入模块: from loguru import logger [as 别名]
# 或者: from loguru.logger import info [as 别名]
def _read_pp2_gene_list(self) -> None:
        """Read gene list for PP2 module.

        Load :attr:`pp2_genes`
        from :attr:`self.config.PP2_gene_list <.CharGerConfig.PP2_gene_list>`.
        Skip PP2 module if not provided.
        """
        gene_list_pth = self.config.PP2_gene_list
        # Disable PP2 module if no list is provided
        if gene_list_pth is None:
            logger.warning(
                "CharGer cannot make PP2 calls without the given gene list. "
                "Disable PP2 module"
            )
            self._acmg_module_availability["PP2"] = ModuleAvailability.INVALID_SETUP
            return

        logger.info(f"Read PP2 gene list from {gene_list_pth}")
        self.pp2_genes = set(l.strip() for l in read_lines(gene_list_pth))
        logger.info(f"Marked {len(self.pp2_genes):,d} genes for PP2") 
开发者ID:ding-lab,项目名称:CharGer,代码行数:22,代码来源:classifier.py

示例11: match_clinvar

# 需要导入模块: from loguru import logger [as 别名]
# 或者: from loguru.logger import info [as 别名]
def match_clinvar(self) -> None:
        """Match the input variant with the ClinVar table.

        Update :attr:`CharGerResult.clinvar` the variant matches a ClinVar record
        by calling :meth:`_match_clinvar_one_variant`.
        """
        if self.config.clinvar_table is None:
            logger.info("Skip matching ClinVar")
            return
        logger.info(
            f"Match input variants with ClinVar table at {self.config.clinvar_table}"
        )
        clinvar_match_num = 0
        with TabixFile(str(self.config.clinvar_table), encoding="utf8") as tabix:
            cols = tabix.header[0][len("#") :].split("\t")
            for result in self.results:
                record = self._match_clinvar_one_variant(result.variant, tabix, cols)
                if record is not None:
                    result.clinvar = record
                    clinvar_match_num += 1
        logger.success(
            f"Matched {clinvar_match_num:,d} out of {len(self.input_variants):,d} input variants to a ClinVar record"
        ) 
开发者ID:ding-lab,项目名称:CharGer,代码行数:25,代码来源:classifier.py

示例12: run_acmg_modules

# 需要导入模块: from loguru import logger [as 别名]
# 或者: from loguru.logger import info [as 别名]
def run_acmg_modules(self) -> None:
        """Run all ACMG modules.

        See :mod:`~charger.acmg_modules` for all the currently implemented
        modules.
        """
        logger.info("Run all ACMG modules")

        def run_or_skip(module_name: str):
            return self._run_or_skip_module(
                module_name, self._acmg_module_availability[module_name]
            )

        # PVS1
        if run_or_skip("PVS1"):
            for result in self.results:
                run_pvs1(result, self.inheritance_genes)

        # PM4
        if run_or_skip("PM4"):
            for result in self.results:
                run_pm4(result, self.inheritance_genes) 
开发者ID:ding-lab,项目名称:CharGer,代码行数:24,代码来源:classifier.py

示例13: _get_asset

# 需要导入模块: from loguru import logger [as 别名]
# 或者: from loguru.logger import info [as 别名]
def _get_asset(self, key):
        url = self._asset_config[key]['url']
        md5 = self._asset_config[key].get('md5')

        target_filename = os.path.basename(urlparse.urlparse(url).path)
        target_path = os.path.join(self._asset_dir, target_filename)
        target_lock = target_path + '.lock'

        with FileLock(target_lock):
            if not os.path.isfile(target_path) or (md5 is not None and _filehash(target_path) != md5):
                logger.info('Downloading asset {} ...', target_filename)
                _download_file(url, target_path)

            if md5 is not None and _filehash(target_path) != md5:
                raise AssetError('Mismatching MD5 checksum on asset %s' % target_filename)

        return target_path 
开发者ID:team-ocean,项目名称:veros,代码行数:19,代码来源:assets.py

示例14: check_isoneutral_slope_crit

# 需要导入模块: from loguru import logger [as 别名]
# 或者: from loguru.logger import info [as 别名]
def check_isoneutral_slope_crit(vs):
    """
    check linear stability criterion from Griffies et al
    """
    epsln = 1e-20
    if vs.enable_neutral_diffusion:
        ft1 = 1.0 / (4.0 * vs.K_iso_0 * vs.dt_tracer + epsln)
        delta1a = np.min(vs.dxt[2:-2, np.newaxis, np.newaxis] * np.abs(vs.cost[np.newaxis, 2:-2, np.newaxis]) \
                * vs.dzt[np.newaxis, np.newaxis, :] * ft1)
        delta1b = np.min(vs.dyt[np.newaxis, 2:-2, np.newaxis] *
                         vs.dzt[np.newaxis, np.newaxis, :] * ft1)
        delta_iso1 = min(
            vs.dzt[0] * ft1 * vs.dxt[-1] * abs(vs.cost[-1]),
            min(delta1a, delta1b)
        )

        logger.info('Diffusion grid factor delta_iso1 = {}', float(delta_iso1))
        if delta_iso1 < vs.iso_slopec:
            raise RuntimeError('Without latitudinal filtering, delta_iso1 is the steepest '
                               'isoneutral slope available for linear stability of '
                               'Redi and GM. Maximum allowable isoneutral slope is '
                               'specified as iso_slopec = {}.'
                               .format(vs.iso_slopec)) 
开发者ID:team-ocean,项目名称:veros,代码行数:25,代码来源:isoneutral.py

示例15: create_super_user

# 需要导入模块: from loguru import logger [as 别名]
# 或者: from loguru.logger import info [as 别名]
def create_super_user(user_id: int, remove: bool) -> bool:
    user = await User.query.where(User.id == user_id).gino.first()
    if not user:
        logger.error("User is not registered in bot")
        raise ValueError("User is not registered in bot")

    logger.info(
        "Loaded user {user}. It's registered at {register_date}.",
        user=user.id,
        register_date=user.created_at,
    )
    await user.update(is_superuser=not remove).apply()
    if remove:
        logger.warning("User {user} now IS NOT superuser", user=user_id)
    else:
        logger.warning("User {user} now IS superuser", user=user_id)
    return True 
开发者ID:aiogram,项目名称:bot,代码行数:19,代码来源:superuser.py


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