本文整理汇总了Python中mozlog.structured.get_default_logger函数的典型用法代码示例。如果您正苦于以下问题:Python get_default_logger函数的具体用法?Python get_default_logger怎么用?Python get_default_logger使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_default_logger函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
def __init__(self, options):
self.options = options
self.logger = commandline.setup_logging("mozregression",
self.options,
{"mach": sys.stdout})
# allow to filter process output based on the user option
if options.process_output is None:
# process_output not user defined
log_process_output = options.build_type != 'opt'
else:
log_process_output = options.process_output == 'stdout'
get_default_logger("process").component_filter = \
lambda data: data if log_process_output else None
# filter some mozversion log lines
re_ignore_mozversion_line = re.compile(
r"^(platform_.+|application_vendor|application_remotingname"
r"|application_id|application_display_name): .+"
)
get_default_logger("mozversion").component_filter = lambda data: (
None if re_ignore_mozversion_line.match(data['message']) else data
)
self.action = None
self.fetch_config = None
示例2: __init__
def __init__(self, device_serial=None):
self.device_serial = device_serial
self._logger = structured.get_default_logger(component='b2gmonkey')
if not self._logger:
self._logger = mozlog.getLogger('b2gmonkey')
self.version = mozversion.get_version(
dm_type='adb', device_serial=device_serial)
device_id = self.version.get('device_id')
if not device_id:
raise B2GMonkeyError('Firefox OS device not found.')
self.device_properties = DEVICE_PROPERTIES.get(device_id)
if not self.device_properties:
raise B2GMonkeyError('Unsupported device: \'%s\'' % device_id)
android_version = self.version.get('device_firmware_version_release')
if device_id == 'flame' and android_version == '4.4.2':
self.device_properties.update(DEVICE_PROPERTIES.get('flame-kk'))
self.temp_dir = tempfile.mkdtemp()
if 'MINIDUMP_SAVE_PATH' not in os.environ:
self.crash_dumps_path = os.path.join(self.temp_dir, 'crashes')
os.environ['MINIDUMP_SAVE_PATH'] = self.crash_dumps_path
else:
self.crash_dumps_path = os.environ['MINIDUMP_SAVE_PATH']
示例3: __init__
def __init__(self, test_paths, force_manifest_update=False):
do_delayed_imports()
self.test_paths = test_paths
self.force_manifest_update = force_manifest_update
self.logger = structured.get_default_logger()
if self.logger is None:
self.logger = structured.structuredlog.StructuredLogger("ManifestLoader")
示例4: run
def run(cls, version=None):
logger = get_default_logger()
try:
dm = mozdevice.DeviceManagerADB(runAdbAsRoot=True)
except mozdevice.DMError as e:
logger.error("Error connecting to device via adb (error: %s). Please be " \
"sure device is connected and 'remote debugging' is enabled." % \
e.msg)
raise
try:
out = dm.shellCheckOutput(['ls', '-alR', '/'], root=True)
except mozdevice.DMError as e:
cls.log_status('FAIL', 'Failed to gather filesystem information from device via adb: %s' % e.msg)
return False
found = []
for f in parse_ls(out):
if f['perm'][2] == 's' and f['uid'] == 'root':
if not cls.whitelist_check(f['name']):
found.append(f['name'])
if len(found) > 0:
cls.log_status('PASS',
'Please ensure that the following suid root files are no security risk:\n%s' % '\n'.join(
found))
else:
cls.log_status('PASS', 'No unexpected suidroot executables found.')
return True
示例5: run
def run(cls, version=None):
logger = get_default_logger()
try:
device = DeviceHelper.getDevice()
except ADBError as e:
logger.error("Error connecting to device via adb (error: %s). Please be " \
"sure device is connected and 'remote debugging' is enabled." % \
e.msg)
raise
try:
out = device.shell_output('ls -alR /', root=True)
except ADBError as e:
cls.log_status('FAIL', 'Failed to gather filesystem information from device via adb: %s' % e.msg)
return False
found = []
for f in parse_ls(out):
if f['perm'][7] == 'w' and f['mode'] != 'l':
if not cls.whitelist_check(f['name']):
found.append(f['name'])
if len(found) > 0:
cls.log_status('PASS',
'Please ensure that the following world-writable files will not pose a security risk:\n%s' % '\n'.join(
found))
else:
cls.log_status('PASS', 'No unexpected suidroot executables found.')
return True
示例6: run
def run(cls, version=None):
logger = get_default_logger()
try:
ps = b2gps()
except Exception as e:
cls.log_status('FAIL', 'Failed to retrieve b2g-ps info: %s' % e)
return False
# list of b2g versions that don't have seccomp support
without_seccomp = ['1.0', '1.1', '1.2', '1.3', '1.3t', '1.4']
if version is not None and version in without_seccomp:
cls.log_status('PASS', "Target version %s doesn't support SECCOMP" % version)
return True
if not ps.has_known_format():
cls.log_status('FAIL', "b2g-ps output from device has unknown format")
return False
if not ps.seccomp_is_enabled():
cls.log_status('FAIL', "Please enable SECCOMP support on the device. The B2G version should support it.")
return False
if not ps.b2g_uses_seccomp():
cls.log_status('FAIL', "Gonk has SECCOMP support, but the B2G process doesn't. Please enable.")
return False
cls.log_status('PASS', "SECCOMP enabled in Gonk and B2G process")
return True
示例7: 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
示例8: __init__
def __init__(self, fetch_config, test_runner, options):
self.fetch_config = fetch_config
self.options = options
self.bisector = Bisector(fetch_config, test_runner,
persist=options.persist,
dl_in_background=options.background_dl)
self._logger = get_default_logger('Bisector')
示例9: run_groups
def run_groups(groups=[], version=None, host='localhost', port=2828, mode='phone'):
hasadb = mode == 'phone'
logger = get_default_logger()
if groups is None or len(groups) == 0: # run all groups
logger.debug('running securitysuite tests for all groups %s' % str(ExtraTest.group_list(mode=mode)))
groups = ExtraTest.group_list(mode=mode)
else:
logger.debug('running securitysuite tests for groups %s' % str(groups))
logger.suite_start(tests=groups)
# setup marionette before any test
marionette = DeviceHelper.getMarionette(host=host, port=port)
# setup device before any test
device = DeviceHelper.getDevice()
for g in groups:
logger.debug("running securitysuite test group %s" % g)
logger.test_start(g)
try:
ExtraTest.run(g, version=version)
logger.test_end(g, 'OK')
except:
logger.critical(traceback.format_exc())
logger.test_end(g, 'FAIL')
raise
logger.suite_end()
示例10: __init__
def __init__(self, find_fix=False):
self.find_fix = find_fix
self.found_repo = None
self.build_range = None
self.good_revision = None
self.bad_revision = None
self._logger = get_default_logger('Bisector')
示例11: __init__
def __init__(self, inbound_branch=None, bits=mozinfo.bits, persist=None):
self.inbound_branch = inbound_branch
self.bits = bits
self.persist = persist
self.build_regex = self._get_build_regex(self.name, bits) + "$"
self.build_info_regex = \
self._get_build_regex(self.name, bits, with_ext=False) + "\.txt$"
self._logger = get_default_logger('Regression Runner')
示例12: __init__
def __init__(self, nightly_runner, inbound_runner, appname="firefox",
last_good_revision=None, first_bad_revision=None):
self.nightly_runner = nightly_runner
self.inbound_runner = inbound_runner
self.appname = appname
self.last_good_revision = last_good_revision
self.first_bad_revision = first_bad_revision
self._logger = get_default_logger('Bisector')
示例13: __init__
def __init__(self):
self.logger = get_default_logger()
try:
self.dm = mozdevice.DeviceManagerADB(runAdbAsRoot=True)
except mozdevice.DMError as e:
self.logger.error("Error connecting to device via adb (error: %s). Please be "
"sure device is connected and 'remote debugging' is enabled." %
e.msg)
raise
示例14: __init__
def __init__(self):
self.logger = get_default_logger()
try:
self.device = DeviceHelper.getDevice()
except ADBError as e:
self.logger.error("Error connecting to device via adb (error: %s). Please be "
"sure device is connected and 'remote debugging' is enabled." %
e.msg)
raise
示例15: cli
def cli(argv=None):
"""
main entry point of mozregression command line.
"""
options = parse_args(argv)
logger = commandline.setup_logging("mozregression",
options,
{"mach": sys.stdout})
check_mozregression_version(logger)
if options.list_releases:
print(formatted_valid_release_dates())
sys.exit()
cache_session = limitedfilecache.get_cache(
options.http_cache_dir, limitedfilecache.ONE_GIGABYTE,
logger=get_default_logger('Limited File Cache'))
set_http_cache_session(cache_session,
get_defaults={"timeout": options.http_timeout})
fetch_config = create_config(options.app, mozinfo.os, options.bits)
if options.command is None:
launcher_kwargs = dict(
addons=options.addons,
profile=options.profile,
cmdargs=options.cmdargs,
preferences=preference(options.prefs_files, options.prefs),
)
test_runner = ManualTestRunner(launcher_kwargs=launcher_kwargs)
else:
test_runner = CommandTestRunner(options.command)
runner = ResumeInfoBisectRunner(fetch_config, test_runner, options)
if fetch_config.is_inbound():
# this can be useful for both inbound and nightly, because we
# can go to inbound from nightly.
fetch_config.set_inbound_branch(options.inbound_branch)
# bisect inbound if last good revision or first bad revision are set
if options.first_bad_revision or options.last_good_revision:
bisect = bisect_inbound
else:
bisect = bisect_nightlies
try:
launcher_class = APP_REGISTRY.get(fetch_config.app_name)
launcher_class.check_is_runnable()
sys.exit(bisect(runner, logger))
except KeyboardInterrupt:
sys.exit("\nInterrupted.")
except UnavailableRelease as exc:
sys.exit("%s\n%s" % (exc, formatted_valid_release_dates()))
except (MozRegressionError, RequestException) as exc:
sys.exit(str(exc))