Bug 1090485 - Fix mozlog's commandline to accept file arguments for a formatter that is also the stdout default.;r=jgraham

This commit is contained in:
Chris Manchester 2014-10-28 17:03:20 -04:00
parent 567fd0e731
commit 6330530055

View File

@ -142,7 +142,7 @@ def setup_logging(suite, args, defaults=None):
# Keep track of any options passed for formatters.
formatter_options = defaultdict(lambda: formatter_option_defaults.copy())
# Keep track of formatters and list of streams specified.
formatters = {}
formatters = defaultdict(list)
found = False
found_stdout_logger = False
if not hasattr(args, 'iteritems'):
@ -164,7 +164,6 @@ def setup_logging(suite, args, defaults=None):
continue
if len(parts) == 2:
_, formatter = parts
formatters[formatter] = []
for value in values:
found = True
if isinstance(value, basestring):
@ -179,12 +178,12 @@ def setup_logging(suite, args, defaults=None):
#If there is no user-specified logging, go with the default options
if not found:
for name, value in defaults.iteritems():
formatters[name] = [value]
formatters[name].append(value)
elif not found_stdout_logger and sys.stdout in defaults.values():
for name, value in defaults.iteritems():
if value == sys.stdout:
formatters[name] = [value]
formatters[name].append(value)
setup_handlers(logger, formatters, formatter_options)
set_default_logger(logger)