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


Python logger.info方法代码示例

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


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

示例1: test_preferences

# 需要导入模块: from logzero import logger [as 别名]
# 或者: from logzero.logger import info [as 别名]
def test_preferences(c: wda.Client):
    print("Status:", c.status())
    print("Info:", c.info)
    print("BatteryInfo", c.battery_info())
    print("AppCurrent:", c.app_current())
    # page_source = c.source()
    # assert "</XCUIElementTypeApplication>" in page_source

    app = c.session(bundle_id)
    selector = app(label="蜂窝网络")
    el = selector.get() 
    el.click()
    print("Element bounds:", el.bounds)

    logger.info("Take screenshot: %s", app.screenshot())
    
    app.swipe_right()
    app.swipe_up()

    app(label="电池").scroll()
    app(label="电池").click() 
开发者ID:openatx,项目名称:facebook-wda,代码行数:23,代码来源:full_example.py

示例2: start_userbot

# 需要导入模块: from logzero import logger [as 别名]
# 或者: from logzero.logger import info [as 别名]
def start_userbot():
    log.info("Starting Userbot...")
    bot_checker.start()
    log.info("Userbot running.")

    await bot_checker.idle()

    if settings.RUN_BOTCHECKER:
        pass
        # botchecker_context.update(
        #     {'checker': bot_checker, 'stop': threading.Event()})
        # updater.job_queue.run_repeating(
        #     botcheckerworker.ping_bots_job,
        #     context=botchecker_context,
        #     first=1.5,
        #     interval=settings.BOTCHECKER_INTERVAL
        # ) 
开发者ID:JosXa,项目名称:BotListBot,代码行数:19,代码来源:main.py

示例3: add_keywords

# 需要导入模块: from logzero import logger [as 别名]
# 或者: from logzero.logger import info [as 别名]
def add_keywords(bot, response, to_check):
    if not isinstance(response, Response) or response.empty:
        return

    full_text = response.full_text.lower()
    # Search for botbuilder pattern to see if this bot is a Manybot/Chatfuelbot/etc.
    if botbuilder_pattern.search(full_text):
        to_check.botbuilder = True

    # Search /start and /help response for global list of keywords
    to_add = []
    for name in Keyword.get_distinct_names(exclude_from_bot=to_check):
        if re.search(r'\b{}\b'.format(name), full_text, re.IGNORECASE):
            to_add.append(name)

    to_add = [x for x in to_add if x not in settings.FORBIDDEN_KEYWORDS]

    if to_add:
        Keyword.insert_many([dict(name=k, entity=to_check) for k in to_add]).execute()
        msg = 'New keyword{}: {} for {}.'.format(
            's' if len(to_add) > 1 else '',
            ', '.join(['#' + k for k in to_add]),
            to_check.str_no_md)
        bot.send_message(settings.BOTLIST_NOTIFICATIONS_ID, msg, timeout=40)
        log.info(msg) 
开发者ID:JosXa,项目名称:BotListBot,代码行数:27,代码来源:botchecker.py

示例4: send_botlist

# 需要导入模块: from logzero import logger [as 别名]
# 或者: from logzero.logger import info [as 别名]
def send_botlist(bot, update, resend=False, silent=False):
    log.info("Re-sending BotList..." if resend else "Updating BotList...")

    channel = helpers.get_channel()
    revision = Revision.get_instance()
    revision.nr += 1
    revision.save()

    all_categories = Category.select_all()

    botlist = BotList(bot, update, channel, resend, silent)
    if resend:
        botlist.delete_full_botlist()
    botlist.update_intro()
    botlist.update_categories(all_categories)
    botlist.update_new_bots_list()
    botlist.update_category_list()
    botlist.send_footer()
    botlist.finish()
    channel.save()
    Statistic.of(update, 'send', 'botlist (resend: {})'.format(str(resend)), Statistic.IMPORTANT) 
开发者ID:JosXa,项目名称:BotListBot,代码行数:23,代码来源:botlist.py

示例5: post

# 需要导入模块: from logzero import logger [as 别名]
# 或者: from logzero.logger import info [as 别名]
def post(self, udid=None):
        """ 设备清理 """
        udid = udid or self.get_argument("udid")
        logger.info("Receive colding request for %s", udid)
        request_secret = self.get_argument("secret")
        if secret != request_secret:
            logger.warning("secret not match, expect %s, got %s", secret,
                           request_secret)
            return

        if udid not in udid2device:
            return

        device = udid2device[udid]
        await device.reset()
        await hbconn.device_update({
            "udid": udid,
            "colding": False,
            "provider": device.addrs(),
        })
        self.write({"success": True, "description": "Device colded"}) 
开发者ID:openatx,项目名称:atxserver2-android-provider,代码行数:23,代码来源:main.py

示例6: _drain_queue

# 需要导入模块: from logzero import logger [as 别名]
# 或者: from logzero.logger import info [as 别名]
def _drain_queue(self):
        """
        Logic:
            - send message to server when server is alive
            - update local db
        """
        while True:
            message = await self._queue.get()
            if message is None:
                logger.info("Resent messages: %s", self._db)
                for _, v in self._db.items():
                    await self._ws.write_message(v)
                continue

            if 'udid' in message:  # ping消息不包含在裡面
                udid = message['udid']
                update_recursive(self._db, {udid: message})
            self._queue.task_done()

            if self._ws:
                try:
                    await self._ws.write_message(message)
                    logger.debug("websocket send: %s", message)
                except TypeError as e:
                    logger.info("websocket write_message error: %s", e) 
开发者ID:openatx,项目名称:atxserver2-android-provider,代码行数:27,代码来源:heartbeat.py

示例7: _connect

# 需要导入模块: from logzero import logger [as 别名]
# 或者: from logzero.logger import info [as 别名]
def _connect(self):
        ws = await websocket.websocket_connect(self._server_ws_url)
        ws.__class__ = SafeWebSocket

        await ws.write_message({
            "command": "handshake",
            "name": self._name,
            "owner": self._owner,
            "secret": self._secret,
            "url": self._provider_url,
            "priority": self._priority,  # the large the importanter
        })

        msg = await ws.read_message()
        logger.info("WS receive: %s", msg)
        return ws 
开发者ID:openatx,项目名称:atxserver2-android-provider,代码行数:18,代码来源:heartbeat.py

示例8: runTest

# 需要导入模块: from logzero import logger [as 别名]
# 或者: from logzero.logger import info [as 别名]
def runTest(self):
        logger.info("runTest")
        d.app_clear(self.package_name)
        s = d.session(self.package_name)
        s.set_fastinput_ime(True)

        xp = d.ext_xpath
        xp._d = s

        # 处理弹窗
        xp.when("跳过").click()
        xp.when("允许").click() # 系统弹窗
        # xp.when("@com.tencent.ibg.joox:id/btn_dismiss").click()

        xp("立即体验").click()
        logger.info("Search")
        xp("搜索").click()
        s.send_keys("周杰伦")
        s.send_action("search")
        self.assertTrue(xp("布拉格广场").wait())
        # xp("@com.tencent.ibg.joox:id/search_area").click()
        # xp("@com.tencent.ibg.joox:id/searchItem").click()
        # s.send_keys("One Call Away")
        # s.send_action("search") 
开发者ID:openatx,项目名称:uiautomator2,代码行数:26,代码来源:xpath_test.py

示例9: validate

# 需要导入模块: from logzero import logger [as 别名]
# 或者: from logzero.logger import info [as 别名]
def validate(ctx: click.Context, source: str,
             no_verify_tls: bool = False) -> Experiment:
    """Validate the experiment at SOURCE."""
    settings = load_settings(ctx.obj["settings_path"])

    try:
        experiment = load_experiment(
            source, settings, verify_tls=not no_verify_tls)
    except InvalidSource as x:
        logger.error(str(x))
        logger.debug(x)
        ctx.exit(1)

    try:
        notify(settings, ValidateFlowEvent.ValidateStarted, experiment)
        ensure_experiment_is_valid(experiment)
        notify(settings, ValidateFlowEvent.ValidateCompleted, experiment)
        logger.info("experiment syntax and semantic look valid")
    except ChaosException as x:
        notify(settings, ValidateFlowEvent.ValidateFailed, experiment, x)
        logger.error(str(x))
        logger.debug(x)
        ctx.exit(1)

    return experiment 
开发者ID:chaostoolkit,项目名称:chaostoolkit,代码行数:27,代码来源:cli.py

示例10: discover

# 需要导入模块: from logzero import logger [as 别名]
# 或者: from logzero.logger import info [as 别名]
def discover(ctx: click.Context, package: str,
             discovery_path: str = "./discovery.json",
             no_system_info: bool = False,
             no_install: bool = False) -> Discovery:
    """Discover capabilities and experiments."""
    settings = load_settings(ctx.obj["settings_path"])
    try:
        notify(settings, DiscoverFlowEvent.DiscoverStarted, package)
        discovery = disco(
            package_name=package, discover_system=not no_system_info,
            download_and_install=not no_install)
    except DiscoveryFailed as err:
        notify(settings, DiscoverFlowEvent.DiscoverFailed, package, err)
        logger.debug("Failed to discover {}".format(package), exc_info=err)
        logger.fatal(str(err))
        return

    with open(discovery_path, "w") as d:
        d.write(json.dumps(discovery, indent=2, default=encoder))
    logger.info("Discovery outcome saved in {p}".format(
        p=discovery_path))

    notify(settings, DiscoverFlowEvent.DiscoverCompleted, discovery)
    return discovery 
开发者ID:chaostoolkit,项目名称:chaostoolkit,代码行数:26,代码来源:cli.py

示例11: line_measurement

# 需要导入模块: from logzero import logger [as 别名]
# 或者: from logzero.logger import info [as 别名]
def line_measurement(self, image, thermal_np, cmap=cv.COLORMAP_JET):
        img = image.copy()
        line, point1, point2 = CFlir.get_line(img)
        line_temps = np.zeros(len(line))
    
        if len(img.shape) == 3:
            gray_values = np.arange(256, dtype=np.uint8)
            color_values = map(tuple, cv.applyColorMap(gray_values, cmap).reshape(256, 3))
            color_to_gray_map = dict(zip(color_values, gray_values))
            img = np.apply_along_axis(lambda bgr: color_to_gray_map[tuple(bgr)], 2, image)
        
        for i in range(0,len(line)):
            line_temps[i] = thermal_np[ line[i][1], line[i][0] ]
            
        cv.line(img, point1, point2, 255, 2, 8)
        
        plt.subplot(1, 5, (1,2) )
        plt.imshow(img, cmap='jet')
        plt.title('Image')
        plt.subplot(1, 5, (4,5) )
        plt.plot(line_temps)
        plt.title('Distance vs Temperature')
        plt.show() 
        
        logger.info(f'\nMin line: {np.amin(line_temps)}\nMax line: {np.amax(line_temps)}' ) 
开发者ID:detecttechnologies,项目名称:Thermal_Image_Analysis,代码行数:27,代码来源:CThermal.py

示例12: __init__

# 需要导入模块: from logzero import logger [as 别名]
# 或者: from logzero.logger import info [as 别名]
def __init__(self, args, train=True):
        self.args = args  # argparse object
        self.logger = logger
        self.start_time = datetime.today()
        self.config = None  # only used for the inference

        if train:  # for training
            self.output_dir = self._return_output_dir()
            self.create_output_dir()
            log_filename = 'train.log'
        else:  # for inference
            self.output_dir = os.path.dirname(args.model)
            self.model_name = os.path.basename(args.model)
            log_filename = 'inference_{}.log'.format(self.model_name)

        log_name = os.path.join(self.output_dir, log_filename)
        logzero.logfile(log_name)
        self.log_name = log_name
        self.logger.info('Log filename: [{}]'.format(log_name)) 
开发者ID:chainer,项目名称:models,代码行数:21,代码来源:resource.py

示例13: dump_git_info

# 需要导入模块: from logzero import logger [as 别名]
# 或者: from logzero.logger import info [as 别名]
def dump_git_info(self):
        """
        returns git commit id, diffs from the latest commit
        """
        if os.system('git rev-parse 2> /dev/null > /dev/null') == 0:
            self.logger.info('Git repository is found. Dumping logs & diffs...')
            git_log = '\n'.join(
                l for l in
                subprocess.check_output('git log --pretty=fuller | head -7', shell=True).decode('utf8').split('\n') if
                l)
            self.logger.info(git_log)

            git_diff = subprocess.check_output('git diff', shell=True).decode('utf8')
            self.logger.info(git_diff)
        else:
            self.logger.warn('Git repository is not found. Continue...') 
开发者ID:chainer,项目名称:models,代码行数:18,代码来源:resource.py

示例14: setup_default_logger

# 需要导入模块: from logzero import logger [as 别名]
# 或者: from logzero.logger import info [as 别名]
def setup_default_logger(logfile=None, level=logging.DEBUG, formatter=None, maxBytes=0, backupCount=0, disableStderrLogger=False):
    """
    Deprecated. Use `logzero.loglevel(..)`, `logzero.logfile(..)`, etc.

    Globally reconfigures the default `logzero.logger` instance.

    Usage:

    .. code-block:: python

        from logzero import logger, setup_default_logger
        setup_default_logger(level=logging.WARN)
        logger.info("hello")  # this will not be displayed anymore because minimum loglevel was set to WARN

    :arg string logfile: If set, also write logs to the specified filename.
    :arg int level: Minimum `logging-level <https://docs.python.org/2/library/logging.html#logging-levels>`_ to display (default: `logging.DEBUG`).
    :arg Formatter formatter: `Python logging Formatter object <https://docs.python.org/2/library/logging.html#formatter-objects>`_ (by default uses the internal LogFormatter).
    :arg int maxBytes: Size of the logfile when rollover should occur. Defaults to 0, rollover never occurs.
    :arg int backupCount: Number of backups to keep. Defaults to 0, rollover never occurs.
    :arg bool disableStderrLogger: Should the default stderr logger be disabled. Defaults to False.
    """
    global logger
    logger = setup_logger(name=LOGZERO_DEFAULT_LOGGER, logfile=logfile, level=level, formatter=formatter, disableStderrLogger=disableStderrLogger)
    return logger 
开发者ID:metachris,项目名称:logzero,代码行数:26,代码来源:__init__.py

示例15: run_triage_worker

# 需要导入模块: from logzero import logger [as 别名]
# 或者: from logzero.logger import info [as 别名]
def run_triage_worker(numbers):
    thispid = os.getpid()
    logger.info('%s started with %s numbers' % (str(thispid), len(numbers)))
    tfh,tfn = tempfile.mkstemp(suffix='.json')
    #logger.info('%s %s' % (thispid, tfh))
    logger.info('%s %s' % (thispid, tfn))

    with open(tfn, 'w') as f:
        f.write(json.dumps(numbers))

    args = sys.argv[1:]
    args.append('--id=%s' % tfn)
    logger.info(args)

    triager = AnsibleTriage(args=args, update_checkouts=False)
    triager.run()

    os.remove(tfn)
    return (tfn) 
开发者ID:ansible,项目名称:ansibullbot,代码行数:21,代码来源:triage_ansible_mp.py


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