Closed Bug 1219461 Opened 4 years ago Closed 3 years ago

Replace PRLogModuleInfo usage with LazyLogModule

Categories

(Core :: XPCOM, defect)

defect
Not set

Tracking

()

RESOLVED FIXED
Tracking Status
firefox44 --- affected

People

(Reporter: erahm, Unassigned)

References

(Blocks 1 open bug)

Details

+++ This bug was initially created as a clone of Bug #1174785 +++

In order to fix various TSan issues and advance the goal of switching away from NSPR logging we need to replace the direct usage of PRLogModuleInfo.

I'll file blocking bugs for doing this within various components.

The following patterns will need to be handled, making this a little tricky to automate. As of filing this there are about 260 instances to replace.

File Scoped Global
==================
> PRLogModuleInfo* (s|g|k)FooLogger;
> ....
> void Foo::Foo()
>   if (!sFooLogger) fooLogger = PR_NewLog("FooLogger");

This would become:
> LazyLogModule (s|g|k)FooLogger("FooLogger");

File Scoped Getter Function
===========================
> PR_LogModuleInfo* GetFooLogger() {
>  static (s|g)?(F|f)ooLogger = nullptr;
>  if (!fooLogger) fooLogger = PR_NewLog("FooLogger");
>  return fooLogger;
> }
> ...
> void blah() { MOZ_LOG(GetFooLogger(), ...); }

This would become:
> LazyLogModule sFooLogger("FooLogger");
> ...
> void blah() { MOZ_LOG(sFooLogger, ...); }

Note: all |GetFooLogger| calls would need to replaced

External variations
===================
Some areas declare an |extern PRLogModuleInfo* sFooLogger|, these would need to be updated as well.
Depends on: 1219464
Depends on: 1219466
Depends on: 1219468
Depends on: 1219470
Depends on: 1219474
Depends on: 1219476
Depends on: 1219478
Depends on: 1219480
Depends on: 1219482
Depends on: 1244091
Depends on: 1257713
Depends on: 1222244
All blockers are complete.
Status: NEW → RESOLVED
Closed: 3 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.