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

Python mozlog.get_default_logger函数代码示例

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

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



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

示例1: __init__

    def __init__(self, app_ctx=None, profile=None, clean_profile=True, env=None,
                 process_class=None, process_args=None, symbols_path=None,
                 dump_save_path=None, addons=None):
        self.app_ctx = app_ctx or DefaultContext()

        if isinstance(profile, basestring):
            self.profile = self.app_ctx.profile_class(profile=profile,
                                                      addons=addons)
        else:
            self.profile = profile or self.app_ctx.profile_class(**getattr(self.app_ctx,
                                                                           'profile_args', {}))

        self.logger = get_default_logger()

        # process environment
        if env is None:
            self.env = os.environ.copy()
        else:
            self.env = env.copy()

        self.clean_profile = clean_profile
        self.process_class = process_class or ProcessHandler
        self.process_args = process_args or {}
        self.symbols_path = symbols_path
        self.dump_save_path = dump_save_path

        self.crashed = 0
开发者ID:lazyparser,项目名称:gecko-dev,代码行数:27,代码来源:runner.py


示例2: kill

 def kill(self, stagedShutdown = False):
     if self.utilityPath:
         # Take a screenshot to capture the screen state just before
         # the application is killed. There are on-device screenshot
         # options but they rarely work well with Firefox on the
         # Android emulator. dump_screen provides an effective
         # screenshot of the emulator and its host desktop.
         dump_screen(self.utilityPath, get_default_logger())
     if stagedShutdown:
         # Trigger an ANR report with "kill -3" (SIGQUIT)
         self.dm.killProcess(self.procName, 3)
         time.sleep(3)
         # Trigger a breakpad dump with "kill -6" (SIGABRT)
         self.dm.killProcess(self.procName, 6)
         # Wait for process to end
         retries = 0
         while retries < 3:
             pid = self.dm.processExist(self.procName)
             if pid and pid > 0:
                 print "%s still alive after SIGABRT: waiting..." % self.procName
                 time.sleep(5)
             else:
                 return
             retries += 1
         self.dm.killProcess(self.procName, 9)
         pid = self.dm.processExist(self.procName)
         if pid and pid > 0:
             self.dm.killProcess(self.procName)
     else:
         self.dm.killProcess(self.procName)
开发者ID:MrAlex94,项目名称:Waterfox,代码行数:30,代码来源:remoteautomation.py


示例3: __init__

 def __init__(self, methodName, **kwargs):
     unittest.TestCase.__init__(self, methodName)
     self.loglines = []
     self.duration = 0
     self.start_time = 0
     self.expected = kwargs.pop('expected', 'pass')
     self.logger = get_default_logger()
开发者ID:nikhilgupta23,项目名称:gecko-dev,代码行数:7,代码来源:marionette_test.py


示例4: run_tests

    def run_tests(self, programs, xre_path, symbols_path=None, interactive=False):
        """
        Run a set of C++ unit test programs.

        Arguments:
        * programs: An iterable containing (test path, test timeout factor) tuples
        * xre_path: A path to a directory containing a XUL Runtime Environment.
        * symbols_path: A path to a directory containing Breakpad-formatted
                        symbol files for producing stack traces on crash.

        Returns True if all test programs exited with a zero status, False
        otherwise.
        """
        self.xre_path = xre_path
        self.log = mozlog.get_default_logger()
        self.log.suite_start(programs)
        env = self.build_environment()
        pass_count = 0
        fail_count = 0
        for prog in programs:
            test_path = prog[0]
            timeout_factor = prog[1]
            single_result = self.run_one_test(test_path, env, symbols_path,
                                              interactive, timeout_factor)
            if single_result:
                pass_count += 1
            else:
                fail_count += 1
        self.log.suite_end()

        # Mozharness-parseable summary formatting.
        self.log.info("Result summary:")
        self.log.info("cppunittests INFO | Passed: %d" % pass_count)
        self.log.info("cppunittests INFO | Failed: %d" % fail_count)
        return fail_count == 0
开发者ID:MichaelKohler,项目名称:gecko-dev,代码行数:35,代码来源:runcppunittests.py


示例5: inner

    def inner(command, *args, **kwargs):
        global logger

        if logger is None:
            logger = get_default_logger("vcs")

        repo = kwargs.pop("repo", None)
        log_error = kwargs.pop("log_error", True)
        if kwargs:
            raise TypeError, kwargs

        args = list(args)

        proc_kwargs = {}
        if repo is not None:
            proc_kwargs["cwd"] = repo

        command_line = [bin_name, command] + args
        logger.debug(" ".join(command_line))
        try:
            return subprocess.check_output(command_line, stderr=subprocess.STDOUT, **proc_kwargs)
        except subprocess.CalledProcessError as e:
            if log_error:
                logger.error(e.output)
            raise
开发者ID:EdgarChen,项目名称:servo,代码行数:25,代码来源:vcs.py


示例6: start

    def start(self, debug_args=None, interactive=False, timeout=None, outputTimeout=None):
        """
        Run self.command in the proper environment.

        :param debug_args: arguments for a debugger
        :param interactive: uses subprocess.Popen directly
        :param timeout: see process_handler.run()
        :param outputTimeout: see process_handler.run()
        :returns: the process id
        """
        self.timeout = timeout
        self.output_timeout = outputTimeout
        cmd = self.command

        # ensure the runner is stopped
        self.stop()

        # attach a debugger, if specified
        if debug_args:
            cmd = list(debug_args) + cmd

        logger = get_default_logger()
        if logger:
            logger.info('Application command: %s' % ' '.join(cmd))
        if interactive:
            self.process_handler = subprocess.Popen(cmd, env=self.env)
            # TODO: other arguments
        else:
            # this run uses the managed processhandler
            self.process_handler = self.process_class(cmd, env=self.env, **self.process_args)
            self.process_handler.run(self.timeout, self.output_timeout)

        self.crashed = 0
        return self.process_handler.pid
开发者ID:cstipkovic,项目名称:gecko-dev,代码行数:34,代码来源:runner.py


示例7: check_for_crashes

    def check_for_crashes(self, dump_directory=None, dump_save_path=None, test_name=None, quiet=False):
        """
        Check for a possible crash and output stack trace.

        :param dump_directory: Directory to search for minidump files
        :param dump_save_path: Directory to save the minidump files to
        :param test_name: Name to use in the crash output
        :param quiet: If `True` don't print the PROCESS-CRASH message to stdout
        :returns: True if a crash was detected, otherwise False
        """
        if not dump_directory:
            dump_directory = os.path.join(self.profile.profile, "minidumps")

        if not dump_save_path:
            dump_save_path = self.dump_save_path

        try:
            logger = get_default_logger()
            if logger is not None:
                if test_name is None:
                    test_name = "runner.py"
                self.crashed += mozcrash.log_crashes(
                    logger, dump_directory, self.symbols_path, dump_save_path=dump_save_path, test=test_name
                )
            else:
                crashed = mozcrash.check_for_crashes(
                    dump_directory, self.symbols_path, dump_save_path=dump_save_path, test_name=test_name, quiet=quiet
                )
                if crashed:
                    self.crashed += 1
        except:
            traceback.print_exc()

        return self.crashed
开发者ID:imace,项目名称:gecko-dev-speech,代码行数:34,代码来源:runner.py


示例8: _get_default_logger

def _get_default_logger():
    from mozlog import get_default_logger
    log = get_default_logger(component='mozleak')

    if not log:
        import logging
        log = logging.getLogger(__name__)
    return log
开发者ID:kitcambridge,项目名称:gecko-dev,代码行数:8,代码来源:leaklog.py


示例9: __init__

 def __init__(self, methodName, **kwargs):
     unittest.TestCase.__init__(self, methodName)
     self.loglines = []
     self.duration = 0
     self.expected = kwargs.pop("expected", "pass")
     self.logger = get_default_logger()
     self.profile = FirefoxProfile()
     self.binary = kwargs.pop("binary", None)
开发者ID:nwgh,项目名称:gecko-dev,代码行数:8,代码来源:session_test.py


示例10: kill

 def kill(self, stagedShutdown=False):
     # Take a screenshot to capture the screen state just before
     # the application is killed.
     if not self.device._device_serial.startswith('emulator-'):
         dump_device_screen(self.device, get_default_logger())
     elif self.utilityPath:
         # Do not use the on-device screenshot options since
         # they rarely work well with Firefox on the Android
         # emulator. dump_screen provides an effective
         # screenshot of the emulator and its host desktop.
         dump_screen(self.utilityPath, get_default_logger())
     if stagedShutdown:
         # Trigger an ANR report with "kill -3" (SIGQUIT)
         try:
             self.device.pkill(self.procName, sig=3, attempts=1)
         except ADBTimeoutError:
             raise
         except:  # NOQA: E722
             pass
         time.sleep(3)
         # Trigger a breakpad dump with "kill -6" (SIGABRT)
         try:
             self.device.pkill(self.procName, sig=6, attempts=1)
         except ADBTimeoutError:
             raise
         except:  # NOQA: E722
             pass
         # Wait for process to end
         retries = 0
         while retries < 3:
             if self.device.process_exist(self.procName):
                 print("%s still alive after SIGABRT: waiting..." % self.procName)
                 time.sleep(5)
             else:
                 return
             retries += 1
         try:
             self.device.pkill(self.procName, sig=9, attempts=1)
         except ADBTimeoutError:
             raise
         except:  # NOQA: E722
             print("%s still alive after SIGKILL!" % self.procName)
         if self.device.process_exist(self.procName):
             self.device.stop_application(self.procName)
     else:
         self.device.stop_application(self.procName)
开发者ID:marcoscaceres,项目名称:gecko-dev,代码行数:46,代码来源:remoteautomation.py


示例11: test_process_output_enabled

def test_process_output_enabled(args, enabled):
    do_cli(*args)
    log_filter = get_default_logger("process").component_filter

    result = log_filter({"some": "data"})
    if enabled:
        assert result
    else:
        assert not result
开发者ID:kbrosnan,项目名称:mozregression,代码行数:9,代码来源:test_cli.py


示例12: test_mozversion_output_filtered

def test_mozversion_output_filtered(mozversion_msg, shown):
    do_cli()
    log_filter = get_default_logger("mozversion").component_filter
    log_data = {"message": mozversion_msg}

    result = log_filter(log_data)
    if shown:
        assert result == log_data
    else:
        assert not result
开发者ID:kbrosnan,项目名称:mozregression,代码行数:10,代码来源:test_cli.py


示例13: log

def log(text, log=True, status_bar=True, status_bar_timeout=2.0):
    if log:
        logger = get_default_logger('mozregui')
        if logger:
            logger.info(text)
    if status_bar:
        from mozregui.mainwindow import MainWindow
        mw = MainWindow.INSTANCE
        if mw:
            mw.ui.status_bar.showMessage(text, int(status_bar_timeout * 1000))
开发者ID:EricRahm,项目名称:mozregression,代码行数:10,代码来源:log_report.py


示例14: __init__

    def __init__(self, methodName, marionette_weakref, fixtures, **kwargs):
        super(CommonTestCase, self).__init__(methodName)
        self.methodName = methodName

        self._marionette_weakref = marionette_weakref
        self.fixtures = fixtures

        self.duration = 0
        self.start_time = 0
        self.expected = kwargs.pop('expected', 'pass')
        self.logger = get_default_logger()
开发者ID:luke-chang,项目名称:gecko-1,代码行数:11,代码来源:testcases.py


示例15: gather_media_debug

        def gather_media_debug(test, status):
            rv = {}
            marionette = test._marionette_weakref()

            if marionette.session is not None:
                try:
                    with marionette.using_context(marionette.CONTEXT_CHROME):
                        debug_lines = marionette.execute_script(debug_script)
                        if debug_lines:
                            name = 'mozMediaSourceObject.mozDebugReaderData'
                            rv[name] = '\n'.join(debug_lines)
                        else:
                            logger = mozlog.get_default_logger()
                            logger.info('No data available about '
                                        'mozMediaSourceObject')
                except:
                    logger = mozlog.get_default_logger()
                    logger.warning('Failed to gather test failure media debug',
                                   exc_info=True)
            return rv
开发者ID:LaiPhil,项目名称:gecko-dev,代码行数:20,代码来源:runtests.py


示例16: gather_debug

        def gather_debug(test, status):
            rv = {}
            marionette = test._marionette_weakref()

            if marionette.session is not None:
                try:
                    self._add_logging_info(rv, marionette)
                except Exception:
                    logger = get_default_logger()
                    logger.warning("Failed to gather test failure debug.",
                                   exc_info=True)
            return rv
开发者ID:beriain,项目名称:requestpolicy,代码行数:12,代码来源:runner.py


示例17: __init__

 def __init__(self, logLevel=None, deviceRoot=None):
     try:
         self._logger = mozlog.get_default_logger(component="mozdevice")
         if not self._logger:  # no global structured logger, fall back to reg logging
             self._logger = mozlog.unstructured.getLogger("mozdevice")
             if logLevel is not None:
                 self._logger.setLevel(logLevel)
     except AttributeError:
         # Structured logging doesn't work on Python 2.6
         self._logger = None
     self._logLevel = logLevel
     self._remoteIsWin = None
     self._isDeviceRootSetup = False
     self._deviceRoot = deviceRoot
开发者ID:MichaelKohler,项目名称:gecko-dev,代码行数:14,代码来源:devicemanager.py


示例18: setup_server_logging

    def setup_server_logging(self):
        server_logger = get_default_logger(component="wptserve")
        assert server_logger is not None
        log_filter = handlers.LogLevelFilter(lambda x:x, "info")
        # Downgrade errors to warnings for the server
        log_filter = LogLevelRewriter(log_filter, ["error"], "warning")
        server_logger.component_filter = log_filter

        try:
            #Set as the default logger for wptserve
            serve.set_logger(server_logger)
            serve.logger = server_logger
        except Exception:
            # This happens if logging has already been set up for wptserve
            pass
开发者ID:hoosteeno,项目名称:gecko-dev,代码行数:15,代码来源:environment.py


示例19: _lint

 def _lint(self, files, linter, **lintargs):
     payload = linter["payload"]
     handler = LintHandler(linter)
     logger = linter.get("logger")
     if logger is None:
         logger = get_default_logger()
     if logger is None:
         logger = structuredlog.StructuredLogger(linter["name"])
         commandline.setup_logging(logger, {}, {"mach": sys.stdout})
     logger.add_handler(handler)
     try:
         payload(files, logger, **lintargs)
     except KeyboardInterrupt:
         pass
     return handler.results
开发者ID:MichaelKohler,项目名称:gecko-dev,代码行数:15,代码来源:types.py


示例20: gather_debug

        def gather_debug(test, status):
            rv = {}
            marionette = test._marionette_weakref()

            # In the event we're gathering debug without starting a session, skip marionette commands
            if marionette.session is not None:
                try:
                    with marionette.using_context(marionette.CONTEXT_CHROME):
                        rv["screenshot"] = marionette.screenshot()
                    with marionette.using_context(marionette.CONTEXT_CONTENT):
                        rv["source"] = marionette.page_source
                except Exception:
                    logger = get_default_logger()
                    logger.warning("Failed to gather test failure debug.", exc_info=True)
            return rv
开发者ID:emilio,项目名称:gecko-dev,代码行数:15,代码来源:base.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Python mozlog.get_proxy_logger函数代码示例发布时间:2022-05-27
下一篇:
Python mozlog.getLogger函数代码示例发布时间: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