Closed Bug 1015287 Opened 7 years ago Closed 7 years ago

Add more complete end-to-end, illustrative examples of mozlog usage (the structured part)

Categories

(Testing :: Mozbase, defect)

x86_64
Linux
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED
mozilla32

People

(Reporter: wlach, Assigned: jgraham)

Details

Attachments

(1 file)

We have a few examples here: http://mozbase.readthedocs.org/en/latest/mozlog_structured.html#examples

... but they don't really describe how you'd use mozlog.structured in an actual test harness, or use the results generated. Some questions it would be nice to have answered through said examples:

1. What logging events need to be generated for treeherder to know what's going on?
2. What's the best way for a testharness to create a logfile that treeherder  can consume?
3. How do I create multiple loggers that all output data in the same format / to the right place? Do I have to create a handler and attach it to the logger every single time?
4. How do I output nice human readable log output onto the console in my test harness?

It would also be nice to describe the expected output of mozlog.structured, not just the API calls that should be made.
Comment on attachment 8431561 [details] [diff] [review]
Add complete example to mozlog.structured documentation.

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

This is great! It's very clear to me now how to properly use mozlog.structured.

::: testing/mozbase/docs/mozlog_structured.rst
@@ -3,5 @@
>  
> -``mozlog.structured`` is a library designed for logging the execution
> -and results of test harnesses. The canonical output format is JSON,
> -with one line of JSON per log entry. It is *not* based on the stdlib
> -logging module, although it shares several concepts with this module.

While we're here, it would be slightly more concise if you replaced "with this module" with "with it" here.
Attachment #8431561 - Flags: review?(wlachance) → review+
https://hg.mozilla.org/mozilla-central/rev/b1350252cf24
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla32
You need to log in before you can comment on or make changes to this bug.