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