Open Bug 2095517 Opened 3 days ago Updated 3 days ago

Define log modules statically from a yaml list

Categories

(Core :: XPCOM, task)

task

Tracking

()

People

(Reporter: dcarver, Assigned: dcarver)

References

(Blocks 1 open bug)

Details

Generate a sorted, constinit list of log modules from a LogModules.yaml file. Look it up in LogModuleManager::CreateOrGetModule before creating a dynamic module. Add StaticLogModule (and mozilla::logmodules::<name> headers) so that C++ code can refer to these modules directly.

LogModule::Get, every LazyLogModule, a JS console's logModule and LogModuleManager::Init (once for each MOZ_LOG term) all go through CreateOrGetModule. So a module in the list would always exist before any of them looks it up.

This lets a module declare settings that have to be known when it is created. One example is whether its profiler markers are filtered out by default (bug 2084269). Today a LazyLogModule can't carry such a setting:

  • Two LazyLogModules with the same name could disagree.
  • The module is created by whichever lookup comes first: one of those LazyLogModules, another LogModule::Get caller, or MOZ_LOG at startup. Once the module exists, a later declaration can't change its default without overriding an explicit MOZ_LOG setting.

With a single static declaration per module, creation order no longer matters, and there is only one place to state the default. Modules that are not in the list keep today's behaviour and emit markers by default.

For now, every module emits markers by default, and the Default case of LogModule::SetMarkers refers to this bug.

See Also: → 2095570
You need to log in before you can comment on or make changes to this bug.