Closed Bug 1073093 Opened 7 years ago Closed 7 years ago

[mozlog] commandline.py should only add a fmt_option if the associated formatter is in log_formatters

Categories

(Testing :: Mozbase, defect)

x86_64
Linux
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED
mozilla36

People

(Reporter: ahal, Assigned: ahal)

Details

Attachments

(1 file)

E.g:
If a program removes --log-foo from the global log_formatters dict, --log-foo-level will still be added to the argument parser.
Attachment #8495432 - Flags: review?(cmanchester)
Comment on attachment 8495432 [details] [diff] [review]
mozlog_fmt_options

Review of attachment 8495432 [details] [diff] [review]:
-----------------------------------------------------------------

I don't see any harm in this, but I guess bug 1066643 might account for this.

::: testing/mozbase/mozlog/mozlog/structured/commandline.py
@@ +63,5 @@
>                               help=help_str)
>          for optname, (cls, help_str, formatters) in fmt_options.iteritems():
>              for fmt in formatters:
> +                # make sure fmt wasn't removed from log_formatters
> +                if fmt in log_formatters.keys():

Could be just 'if fmt in log_formatters:'
Attachment #8495432 - Flags: review?(cmanchester) → review+
https://hg.mozilla.org/mozilla-central/rev/c6ab97a41edb
Status: ASSIGNED → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla36
You need to log in before you can comment on or make changes to this bug.