• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python logging.log函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中modules.logging.log函数的典型用法代码示例。如果您正苦于以下问题:Python log函数的具体用法?Python log怎么用?Python log使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: begin_work_queue

 def begin_work_queue(self):
     log("CAUTION: %s will discard all local changes in \"%s\"" % (self.name, self.tool.scm().checkout_root))
     if self.options.confirm:
         response = raw_input("Are you sure?  Type \"yes\" to continue: ")
         if (response != "yes"):
             error("User declined.")
     log("Running WebKit %s." % self.name)
开发者ID:jackiekaon,项目名称:owb-mirror,代码行数:7,代码来源:queues.py


示例2: fetch_attachments_from_bug

    def fetch_attachments_from_bug(self, bug_id):
        bug_url = self.bug_url_for_bug_id(bug_id, xml=True)
        log("Fetching: " + bug_url)

        page = urllib2.urlopen(bug_url)
        soup = BeautifulSoup(page)

        attachments = []
        for element in soup.findAll("attachment"):
            attachment = {}
            attachment["bug_id"] = bug_id
            attachment["is_obsolete"] = element.has_key("isobsolete") and element["isobsolete"] == "1"
            attachment["is_patch"] = element.has_key("ispatch") and element["ispatch"] == "1"
            attachment["id"] = str(element.find("attachid").string)
            attachment["url"] = self.attachment_url_for_id(attachment["id"])
            attachment["name"] = unicode(element.find("desc").string)
            attachment["type"] = str(element.find("type").string)

            review_flag = element.find("flag", attrs={"name": "review"})
            if review_flag and review_flag["status"] == "+":
                reviewer_email = review_flag["setter"]
                # We could lookup the full email address instead once we update full_name_from_bugzilla_name
                bugzilla_name = reviewer_email.split("@")[0]
                attachment["reviewer"] = self.full_name_from_bugzilla_name(bugzilla_name)

            attachments.append(attachment)
        return attachments
开发者ID:jackiekaon,项目名称:owb-mirror,代码行数:27,代码来源:bugzilla.py


示例3: authenticate

    def authenticate(self):
        if self.authenticated:
            return

        if self.dryrun:
            log("Skipping log in for dry run...")
            self.authenticated = True
            return

        (username, password) = read_credentials()

        log("Logging in as %s..." % username)
        self.browser.open(self.bug_server_url + "index.cgi?GoAheadAndLogIn=1")
        self.browser.select_form(name="login")
        self.browser["Bugzilla_login"] = username
        self.browser["Bugzilla_password"] = password
        response = self.browser.submit()

        match = re.search("<title>(.+?)</title>", response.read())
        # If the resulting page has a title, and it contains the word "invalid" assume it's the login failure page.
        if match and re.search("Invalid", match.group(1), re.IGNORECASE):
            # FIXME: We could add the ability to try again on failure.
            error("Bugzilla login failed: %s" % match.group(1))

        self.authenticated = True
开发者ID:jackiekaon,项目名称:owb-mirror,代码行数:25,代码来源:bugzilla.py


示例4: credentials_from_keychain

def credentials_from_keychain(username=None):
    if not is_mac_os_x():
        return [username, None]

    command = "/usr/bin/security %s -g -s %s" % ("find-internet-password", Bugzilla.bug_server_host)
    if username:
        command += " -a %s" % username

    log('Reading Keychain for %s account and password.  Click "Allow" to continue...' % Bugzilla.bug_server_host)
    keychain_process = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, shell=True)
    value = keychain_process.communicate()[0]
    exit_code = keychain_process.wait()

    if exit_code:
        return [username, None]

    match = re.search('^\s*"acct"<blob>="(?P<username>.+)"', value, re.MULTILINE)
    if match:
        username = match.group('username')

    password = None
    match = re.search('^password: "(?P<password>.+)"', value, re.MULTILINE)
    if match:
        password = match.group('password')

    return [username, password]
开发者ID:dzip,项目名称:webkit,代码行数:26,代码来源:bugzilla.py


示例5: ensure_clean_working_directory

 def ensure_clean_working_directory(self, force):
     if not force and not self.working_directory_is_clean():
         print self.run_command(self.status_command(), raise_on_failure=False)
         error("Working directory has modifications, pass --force-clean or --no-clean to continue.")
     
     log("Cleaning working directory")
     self.clean_working_directory()
开发者ID:MekliCZ,项目名称:positron,代码行数:7,代码来源:scm.py


示例6: create_bug_with_patch

    def create_bug_with_patch(self, bug_title, bug_description, component, patch_file_object, patch_description, cc, mark_for_review=False):
        self.authenticate()

        log('Creating bug with patch description "%s"' % patch_description)
        if self.dryrun:
            log(bug_description)
            return

        self.browser.open(self.bug_server_url + "enter_bug.cgi?product=WebKit")
        self.browser.select_form(name="Create")
        component_items = self.browser.find_control('component').items
        component_names = map(lambda item: item.name, component_items)
        if not component or component not in component_names:
            component = self.prompt_for_component(component_names)
        self.browser['component'] = [component]
        if cc:
            self.browser['cc'] = cc
        self.browser['short_desc'] = bug_title
        if bug_description:
            log(bug_description)
            self.browser['comment'] = bug_description
        self.browser['description'] = patch_description
        self.browser['ispatch'] = ("1",)
        self.browser['flag_type-1'] = ('?',) if mark_for_review else ('X',)
        self.browser.add_file(patch_file_object, "text/plain", "%s.patch" % timestamp(), 'data')
        response = self.browser.submit()

        bug_id = self._check_create_bug_response(response.read())
        log("Bug %s created." % bug_id)
        log("%sshow_bug.cgi?id=%s" % (self.bug_server_url, bug_id))
        return bug_id
开发者ID:dzip,项目名称:webkit,代码行数:31,代码来源:bugzilla.py


示例7: _fetch_list_of_patches_to_process

 def _fetch_list_of_patches_to_process(self, options, args, tool):
     all_patches = []
     for bug_id in args:
         patches = tool.bugs.fetch_reviewed_patches_from_bug(bug_id)
         log("%s found on bug %s." % (pluralize("reviewed patch", len(patches)), bug_id))
         all_patches += patches
     return all_patches
开发者ID:jackiekaon,项目名称:owb-mirror,代码行数:7,代码来源:download.py


示例8: run

    def run(self):
        self._begin_logging()

        self._delegate.begin_work_queue()
        while (self._delegate.should_continue_work_queue()):
            try:
                self._ensure_work_log_closed()
                work_item = self._delegate.next_work_item()
                if not work_item:
                    self._sleep("No work item.")
                    continue
                if not self._delegate.should_proceed_with_work_item(work_item):
                    self._sleep("Not proceeding with work item.")
                    continue

                # FIXME: Work logs should not depend on bug_id specificaly.
                #        This looks fixed, no?
                self._open_work_log(work_item)
                try:
                    self._delegate.process_work_item(work_item)
                except ScriptError, e:
                    # Use a special exit code to indicate that the error was already
                    # handled in the child process and we should just keep looping.
                    if e.exit_code == self.handled_error_code:
                        continue
                    message = "Unexpected failure when landing patch!  Please file a bug against bugzilla-tool.\n%s" % e.message_with_output()
                    self._delegate.handle_unexpected_error(work_item, message)
            except KeyboardInterrupt, e:
                log("\nUser terminated queue.")
                return 1
            except Exception, e:
                traceback.print_exc()
                # Don't try tell the status bot, in case telling it causes an exception.
                self._sleep("Exception while preparing queue: %s." % e)
开发者ID:jackiekaon,项目名称:owb-mirror,代码行数:34,代码来源:queueengine.py


示例9: _run_security_tool

    def _run_security_tool(self, username=None):
        security_command = ["/usr/bin/security", "find-internet-password", "-g", "-s", self.host]
        if username:
            security_command += ["-a", username]

        log('Reading Keychain for %s account and password.  Click "Allow" to continue...' % self.host)
        return self.executive.run_command(security_command)
开发者ID:jackiekaon,项目名称:owb-mirror,代码行数:7,代码来源:credentials.py


示例10: ensure_clean_working_directory

 def ensure_clean_working_directory(self, force):
     if not force and not self.working_directory_is_clean():
         print self.run_command(self.status_command(), error_handler=ignore_error)
         raise ScriptError(message="Working directory has modifications, pass --force-clean or --no-clean to continue.")
     
     log("Cleaning working directory")
     self.clean_working_directory()
开发者ID:jackiekaon,项目名称:owb-mirror,代码行数:7,代码来源:scm.py


示例11: prompt_for_component

 def prompt_for_component(self, components):
     log("Please pick a component:")
     i = 0
     for name in components:
         i += 1
         log("%2d. %s" % (i, name))
     result = int(raw_input("Enter a number: ")) - 1
     return components[result]
开发者ID:jackiekaon,项目名称:owb-mirror,代码行数:8,代码来源:bugzilla.py


示例12: _guess_reviewer_from_bug

 def _guess_reviewer_from_bug(self, bug_id):
     patches = self._tool.bugs.fetch_reviewed_patches_from_bug(bug_id)
     if len(patches) != 1:
         log("%s on bug %s, cannot infer reviewer." % (pluralize("reviewed patch", len(patches)), bug_id))
         return None
     patch = patches[0]
     reviewer = patch["reviewer"]
     log("Guessing \"%s\" as reviewer from attachment %s on bug %s." % (reviewer, patch["id"], bug_id))
     return reviewer
开发者ID:jackiekaon,项目名称:owb-mirror,代码行数:9,代码来源:buildsteps.py


示例13: run

 def run(self, state):
     if not self._options.obsolete_patches:
         return
     bug_id = state["bug_id"]
     patches = self._tool.bugs.fetch_patches_from_bug(bug_id)
     if not patches:
         return
     log("Obsoleting %s on bug %s" % (pluralize("old patch", len(patches)), bug_id))
     for patch in patches:
         self._tool.bugs.obsolete_attachment(patch["id"])
开发者ID:jackiekaon,项目名称:owb-mirror,代码行数:10,代码来源:buildsteps.py


示例14: execute

    def execute(self, options, args, tool):
        self._prepare_to_process(options, args, tool)
        patches = self._fetch_list_of_patches_to_process(options, args, tool)

        # It's nice to print out total statistics.
        bugs_to_patches = self._collect_patches_by_bug(patches)
        log("Processing %s from %s." % (pluralize("patch", len(patches)), pluralize("bug", len(bugs_to_patches))))

        for patch in patches:
            self._process_patch(patch, options, args, tool)
开发者ID:jackiekaon,项目名称:owb-mirror,代码行数:10,代码来源:download.py


示例15: run_and_handle_errors

 def run_and_handle_errors(self, tool, options, state=None):
     if not state:
         state = {}
     try:
         self._run(tool, options, state)
     except CheckoutNeedsUpdate, e:
         log("Commit failed because the checkout is out of date.  Please update and try again.")
         log(
             "You can pass --no-build to skip building/testing after update if you believe the new commits did not affect the results."
         )
         QueueEngine.exit_after_handled_error(e)
开发者ID:jackiekaon,项目名称:owb-mirror,代码行数:11,代码来源:stepsequence.py


示例16: add_cc_to_bug

    def add_cc_to_bug(self, bug_id, email_address_list):
        self.authenticate()

        log("Adding %s to the CC list for bug %s" % (email_address_list, bug_id))
        if self.dryrun:
            return

        self.browser.open(self.bug_url_for_bug_id(bug_id))
        self.browser.select_form(name="changeform")
        self.browser["newcc"] = ", ".join(email_address_list)
        self.browser.submit()
开发者ID:jackiekaon,项目名称:owb-mirror,代码行数:11,代码来源:bugzilla.py


示例17: check_arguments_and_execute

 def check_arguments_and_execute(self, options, args, tool=None):
     if len(args) < len(self.required_arguments):
         log("%s required, %s provided.  Provided: %s  Required: %s\nSee '%s help %s' for usage." % (
             pluralize("argument", len(self.required_arguments)),
             pluralize("argument", len(args)),
             "'%s'" % " ".join(args),
             " ".join(self.required_arguments),
             tool.name(),
             self.name))
         return 1
     return self.execute(options, args, tool) or 0
开发者ID:jackiekaon,项目名称:owb-mirror,代码行数:11,代码来源:multicommandtool.py


示例18: _needs_commit_queue

    def _needs_commit_queue(patch):
        commit_queue_flag = patch.get("commit-queue")
        if (commit_queue_flag and commit_queue_flag == '+'): # If it's already cq+, ignore the patch.
            log("%s already has cq=%s" % (patch["id"], commit_queue_flag))
            return False

        # We only need to worry about patches from contributers who are not yet committers.
        committer_record = CommitterList().committer_by_email(patch["attacher_email"])
        if committer_record:
            log("%s committer = %s" % (patch["id"], committer_record))
        return not committer_record
开发者ID:jackiekaon,项目名称:owb-mirror,代码行数:11,代码来源:queries.py


示例19: post_comment_to_bug

    def post_comment_to_bug(self, bug_id, comment_text):
        self.authenticate()

        log("Adding comment to bug %s" % bug_id)
        if self.dryrun:
            log(comment_text)
            return

        self.browser.open(self.bug_url_for_bug_id(bug_id))
        self.browser.select_form(name="changeform")
        self.browser["comment"] = comment_text
        self.browser.submit()
开发者ID:jackiekaon,项目名称:owb-mirror,代码行数:12,代码来源:bugzilla.py


示例20: fetch_attachments_from_bug

    def fetch_attachments_from_bug(self, bug_id):
        bug_url = self.bug_url_for_bug_id(bug_id, xml=True)
        log("Fetching: %s" % bug_url)

        page = urllib2.urlopen(bug_url)
        soup = BeautifulSoup(page)

        attachments = []
        for element in soup.findAll('attachment'):
            attachment = self._parse_attachment_element(element, bug_id)
            attachments.append(attachment)
        return attachments
开发者ID:dzip,项目名称:webkit,代码行数:12,代码来源:bugzilla.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python sickbeard.sickbeard_api函数代码示例发布时间:2022-05-27
下一篇:
Python client.source函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap