當前位置: 首頁>>代碼示例>>Python>>正文


Python logger.info方法代碼示例

本文整理匯總了Python中common.logger.info方法的典型用法代碼示例。如果您正苦於以下問題:Python logger.info方法的具體用法?Python logger.info怎麽用?Python logger.info使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在common.logger的用法示例。


在下文中一共展示了logger.info方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: filter_file

# 需要導入模塊: from common import logger [as 別名]
# 或者: from common.logger import info [as 別名]
def filter_file(self):
        file_list = self.file_list
        if len(file_list) == 0:
            return False
        for r in file_list:
            file_size = os.path.getsize(r) / 1024 / 1024 / 1024
            if file_size <= 0.02:
                os.remove(r)
                logger.info('過濾刪除-' + r)
        file_list = self.file_list
        if len(file_list) == 0:
            logger.info('視頻過濾後無文件可傳')
            return False
        for f in file_list:
            if f.endswith('.part'):
                os.rename(f, os.path.splitext(f)[0])
                logger.info('%s存在已更名' % f)
        return True 
開發者ID:ForgQi,項目名稱:bilibiliupload,代碼行數:20,代碼來源:upload.py

示例2: login

# 需要導入模塊: from common import logger [as 別名]
# 或者: from common.logger import info [as 別名]
def login(driver, filename):
        logger.info('準備更新cookie')
        # screen_shot = driver.save_screenshot('bin/1.png')
        WebDriverWait(driver, 10).until(
            ec.presence_of_element_located((By.XPATH, r'//*[@id="login-username"]')))
        username = driver.find_element_by_xpath(r'//*[@id="login-username"]')
        username.send_keys(engine.user_name)
        password = driver.find_element_by_xpath('//*[@id="login-passwd"]')
        password.send_keys(engine.pass_word)
        driver.find_element_by_class_name("btn-login").click()
        # logger.info('第四步')
        # try:
        cracker = slider_cracker(driver)
        cracker.crack()
        # except:
        #     logger.exception('出錯')
        time.sleep(5)
        if driver.title == '投稿 - 嗶哩嗶哩彈幕視頻網 - ( ゜- ゜)つロ 乾杯~ - bilibili':
            cookie = driver.get_cookies()
            print(cookie)
            with open(filename, "w") as f:
                json.dump(cookie, f)
            logger.info('更新cookie成功')
        else:
            logger.info('更新cookie失敗') 
開發者ID:ForgQi,項目名稱:bilibiliupload,代碼行數:27,代碼來源:upload.py

示例3: start

# 需要導入模塊: from common import logger [as 別名]
# 或者: from common.logger import info [as 別名]
def start(self):
        file_name = self.file_name
        self.ydl_opts = {'outtmpl': file_name}
        if self.check_stream():
            pid = os.getpid()
            monitor = Monitoring(pid, file_name)
            self.flag = monitor.flag
            t = Thread(target=monitor.start)
            t.start()
            retval = self.download()
            self.rename(file_name)
            monitor.stop()
            if retval != 0:
                logger.debug('準備遞歸下載')
                self.start()
            else:
                logger.info('下載完成' + self.fname) 
開發者ID:ForgQi,項目名稱:bilibiliupload,代碼行數:19,代碼來源:__init__.py

示例4: kill_child_processes

# 需要導入模塊: from common import logger [as 別名]
# 或者: from common.logger import info [as 別名]
def kill_child_processes(self):
        file_size = os.path.getsize(self.file_name) / 1024 / 1024 / 1024
        if file_size <= self.last_file_size:
            logger.error('下載卡死' + self.file_name)
            if self.numc == 0:
                self.parent.terminate()
            else:
                self.terminate()
            time.sleep(1)
            if os.path.isfile(self.file_name):
                logger.info('卡死下載進程可能未成功退出')
                return
            else:
                self.stop()
                logger.info('卡死下載進程成功退出')
                return
        self.last_file_size = file_size
        if file_size >= 2.5:
            if self.numc == 0:
                self.flag.set()
            else:
                self.terminate()
            logger.info('分段下載' + self.file_name) 
開發者ID:ForgQi,項目名稱:bilibiliupload,代碼行數:25,代碼來源:__init__.py

示例5: _startup

# 需要導入模塊: from common import logger [as 別名]
# 或者: from common.logger import info [as 別名]
def _startup(self):
        logger.info("正在啟動微信登錄過程...")
        self.__process_login()

        #保存rasa的引用
        logger.info("微信機器人登錄結束...")

        #在啟動後,直接調用register來注冊一個on_message函數,到指定的微信群上
        #為何要在這裏做呢?因為如果這個時候不做,後麵這句 bot.join就會阻塞這個過程
        #如果在外麵調用,必須等待這個_startup運行完畢,
        #但是,這裏麵必須要寫個
        #self.register(group_names)
        #這個線程,會掛在這裏,防止退出


    #能bot.search到的群,應該都是之前注冊的那些群 
開發者ID:newsettle,項目名稱:ns4_chatbot,代碼行數:18,代碼來源:wxbot.py

示例6: check_in

# 需要導入模塊: from common import logger [as 別名]
# 或者: from common.logger import info [as 別名]
def check_in(self):
        """ inform backend that we started a manager, sending resources info """
        logger.info(f"checking-in with the API…")

        host_stats = query_host_stats(self.docker, self.workdir)
        success, status_code, response = self.query_api(
            "PUT",
            f"/workers/{self.worker_name}/check-in",
            payload={
                "username": self.username,
                "selfish": self.selfish,
                "cpu": host_stats["cpu"]["total"],
                "memory": host_stats["memory"]["total"],
                "disk": host_stats["disk"]["total"],
                "offliners": SUPPORTED_OFFLINERS,
                "platforms": PLATFORMS_TASKS,
            },
        )
        if not success:
            logger.error("\tunable to check-in with the API.")
            logger.debug(status_code)
            logger.debug(response)
            raise SystemExit()
        logger.info("\tchecked-in!") 
開發者ID:openzim,項目名稱:zimfarm,代碼行數:26,代碼來源:worker.py

示例7: handle_broadcast_event

# 需要導入模塊: from common import logger [as 別名]
# 或者: from common.logger import info [as 別名]
def handle_broadcast_event(self, received_string):
        try:
            key, data = received_string.split(" ", 1)
            payload = json.loads(data)
            logger.info(f"received {key} - {data[:100]}")
            logger.debug(f"received: {key} – {json.dumps(payload, indent=4)}")
        except Exception as exc:
            logger.exception(exc)
            logger.info(received_string)
            return

        if key == "cancel-task":
            if payload in self.tasks.keys():
                self.cancel_and_remove_task(payload)
            else:
                logger.debug("not our task, discarding")
        elif key in ("requested-task", "requested-tasks"):
            # incoming task. wait <nb-running> x <sleep_itvl> seconds before polling
            # to allow idle workers to pick this up first
            time.sleep(self.sleep_interval * len(self.tasks))
            self.poll() 
開發者ID:openzim,項目名稱:zimfarm,代碼行數:23,代碼來源:worker.py

示例8: run

# 需要導入模塊: from common import logger [as 別名]
# 或者: from common.logger import info [as 別名]
def run(self):
        if self.should_stop:  # early exit
            return 1

        context = zmq.Context()
        socket = context.socket(zmq.SUB)

        logger.info(f"subscribing to events from {self.socket_uri}…")
        socket.connect(self.socket_uri)
        for event in self.events:
            logger.debug(f".. {event}")
            socket.setsockopt_string(zmq.SUBSCRIBE, event)

        while not self.should_stop:
            try:
                received_string = socket.recv_string(zmq.DONTWAIT)
                self.handle_broadcast_event(received_string)
            except zmq.Again:
                pass

            if self.should_poll:
                self.sync_tasks_and_containers()
                self.poll()
            else:
                self.sleep() 
開發者ID:openzim,項目名稱:zimfarm,代碼行數:27,代碼來源:worker.py

示例9: check_docker

# 需要導入模塊: from common import logger [as 別名]
# 或者: from common.logger import info [as 別名]
def check_docker(self):

        logger.info(f"testing docker API on {DOCKER_SOCKET}…")
        if (
            not DOCKER_SOCKET.exists()
            or not DOCKER_SOCKET.is_socket()
            or not os.access(DOCKER_SOCKET, os.R_OK)
        ):
            logger.critical(f"\tsocket ({DOCKER_SOCKET}) not available.")
            sys.exit(1)
        self.docker = docker.DockerClient(
            base_url=f"unix://{DOCKER_SOCKET}", timeout=DOCKER_CLIENT_TIMEOUT
        )
        try:
            if len(self.docker.containers.list(all=False)) < 1:
                logger.warning("\tno running container, am I out-of-docker?")
        except Exception as exc:
            logger.critical("\tdocker API access failed: exiting.")
            logger.exception(exc)
            sys.exit(1)
        else:
            logger.info("\tdocker API access successful") 
開發者ID:openzim,項目名稱:zimfarm,代碼行數:24,代碼來源:worker.py

示例10: remove_filelist

# 需要導入模塊: from common import logger [as 別名]
# 或者: from common.logger import info [as 別名]
def remove_filelist(file_list):
        for r in file_list:
            os.remove(r)
            logger.info('刪除-' + r) 
開發者ID:ForgQi,項目名稱:bilibiliupload,代碼行數:6,代碼來源:upload.py

示例11: add_videos

# 需要導入模塊: from common import logger [as 別名]
# 或者: from common.logger import info [as 別名]
def add_videos(self, driver, title_, videopath):
        WebDriverWait(driver, 20).until(
            ec.presence_of_element_located((By.NAME, 'buploader')))
        upload = driver.find_element_by_name('buploader')
        # print(driver.title)
        # logger.info(driver.title)
        upload.send_keys(videopath)  # send_keys
        logger.info('開始上傳' + title_)
        time.sleep(2)
        button = r'//*[@class="new-feature-guide-v2-container"]/div/div/div/div/div[1]'
        if self.is_element_exist(driver, button):
            sb = driver.find_element_by_xpath(button)
            sb.click()
            sb.click()
            sb.click()
            logger.debug('點擊')
        while True:
            try:
                info = driver.find_elements_by_class_name(r'item-upload-info')
                for t in info:
                    if t.text != '':
                        print(t.text)
                time.sleep(10)
                text = driver.find_elements_by_xpath(r'//*[@class="item-upload-info"]/span')
                aggregate = set()
                for s in text:
                    if s.text != '':
                        aggregate.add(s.text)
                        print(s.text)

                if len(aggregate) == 1 and ('Upload complete' in aggregate or '上傳完成' in aggregate):
                    break
            except selenium.common.exceptions.StaleElementReferenceException:
                logger.exception("selenium.common.exceptions.StaleElementReferenceException")
        logger.info('上傳%s個數%s' % (title_, len(info))) 
開發者ID:ForgQi,項目名稱:bilibiliupload,代碼行數:37,代碼來源:upload.py

示例12: start

# 需要導入模塊: from common import logger [as 別名]
# 或者: from common.logger import info [as 別名]
def start(self, url, date=None):
        title = self.title
        if date:
            title = str(date) + self.title
        if self.filter_file():
            logger.info('準備上傳' + title)
            try:
                self.upload(title, self.file_list, link=url)
            except selenium.common.exceptions.WebDriverException:
                logger.exception('WebDriverException')
            # except :
            #     logger.exception('?') 
開發者ID:ForgQi,項目名稱:bilibiliupload,代碼行數:14,代碼來源:upload.py

示例13: rename

# 需要導入模塊: from common import logger [as 別名]
# 或者: from common.logger import info [as 別名]
def rename(file_name):
        try:
            os.rename(file_name + '.part', file_name)
            logger.debug('更名{0}為{1}'.format(file_name + '.part', file_name))
        except FileNotFoundError:
            logger.info('FileNotFoundError:' + file_name)
        except FileExistsError:
            os.rename(file_name + '.part', file_name)
            logger.info('FileExistsError:更名{0}為{1}'.format(file_name + '.part', file_name)) 
開發者ID:ForgQi,項目名稱:bilibiliupload,代碼行數:11,代碼來源:__init__.py

示例14: get_sinfo

# 需要導入模塊: from common import logger [as 別名]
# 或者: from common.logger import info [as 別名]
def get_sinfo(self):
        info_list = []
        with youtube_dl.YoutubeDL() as ydl:
            # cu = self.url.get(self.__class__.__name__)
            if self.url:
                info = ydl.extract_info(self.url, download=False)
            else:
                logger.debug('%s不存在' % self.__class__.__name__)
                return
            for i in info['formats']:
                info_list.append(i['format_id'])
            logger.debug(info_list)
        return info_list 
開發者ID:ForgQi,項目名稱:bilibiliupload,代碼行數:15,代碼來源:__init__.py

示例15: terminate

# 需要導入模塊: from common import logger [as 別名]
# 或者: from common.logger import info [as 別名]
def terminate(self):
        if self.numc == 0:
            logger.error("ChildrenProcess doesn't exist")
        else:
            for process in self.children:
                process.terminate()
            # logger.info('下載卡死' + self.file_name) 
開發者ID:ForgQi,項目名稱:bilibiliupload,代碼行數:9,代碼來源:__init__.py


注:本文中的common.logger.info方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。