Closed Bug 1259807 Opened 9 years ago Closed 2 years ago

Add documentation for MOZ_LOG

Categories

(Core :: XPCOM, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
Tracking Status
firefox48 --- affected

People

(Reporter: erahm, Unassigned)

References

(Blocks 1 open bug)

Details

(Keywords: dev-doc-needed)

+++ This bug was initially created as a clone of Bug #1248565 +++ With the introduction of MOZ_LOG as the preferred alternative to NSPR logging we never actually added MDN documentation. There is documentation for NSPR logging [1], but that's under the NSPR project so we should probably add a separate page. This should include documentation of the macros: - MOZ_LOG - MOZ_LOG_TEST The preferred method of creating a log module: - mozilla::LazyLogModule Details of log levels: > enum class LogLevel { > Disabled = 0, > Error, > Warning, > Info, > Debug, > Verbose, >}; We could include the NSPR mapping here, but honestly I don't want people thinking about NSPR. Maybe in a footnote. How to enable logging: - Via MOZ_LOG_MODULES - Via the 'logging.foo' prefs How to send logging to a file: - Via MOZ_LOG_FILE - Via the soon to be 'logging.config.*' prefs An example snippet of code: > static LazyLogModule sFoo("foo"); > void Foo() { MOZ_LOG(sFoo, LogLevel::Debug, "A debug message"); } > // etc... And some footnotes on NSPR logging: - Setting the NSPR_LOG_MODULES env var separately for NSS and NSPR log modules - Our fallback to NSPR_LOG_MODULES and NSPR_LOG_FILE of MOZ_* are not specified [1] https://developer.mozilla.org/en-US/docs/Mozilla/Projects/NSPR/Reference/Logging
Oh right, I already did this [1]. We still need to add updates bout the MOZ_LOG env vars and LazyLogModule. [1] https://developer.mozilla.org/en-US/docs/Mozilla/Developer_guide/Gecko_Logging

how about listing all the available modules and what code area the corresponding module logs for ? so far my option is https://searchfox.org/mozilla-central/search?q=LazyLogModule&path= but that's a bit meh

I think this work was complete here, right? Or are we still missing something?

(In reply to Gabriele Svelto [:gsvelto] from comment #3)

I think this work was complete here, right? Or are we still missing something?

I think we're done here.

Status: NEW → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.