Parse MOZ_LOG module lists in one place, in C++
Categories
(Core :: XPCOM, task)
Tracking
()
People
(Reporter: dcarver, Assigned: dcarver)
References
(Blocks 3 open bugs)
Details
Attachments
(5 external files, 1 obsolete file)
The MOZ_LOG syntax (name:level,name:level, plus options such as timestamp) is parsed in two places:
- C++: NSPRLogModulesParser, with the options handled by LogModuleManager::Init.
- JS: setLogModules in about:logging.
They disagree:
Login crypto:5: JS configures one module,Login crypto(Verbose), but C++ configures two,Login(Error) andcrypto(Verbose). (Login crypto is not the only example with special characters)timestamp, nsHttp:5: JS configures a new modulensHttp(with a leading space), but C++ configuresnsHttp(without a leading space).
We should have a single parser in C++, exposed to chrome JS (for example ChromeUtils.parseLogModules()), and make about:logging use it. The behavior of MOZ_LOG should not change.
| Assignee | ||
Comment 1•1 month ago
|
||
NSPRLogModulesParser now calls its callback with a LogModulesEntry, which is
either a log module with its level or one of the MOZ_LOG options, each with
its own type. The options are listed once, so LogModuleManager::Init and the
Windows sandbox broker no longer compare option names themselves.
The tokenizer is unchanged, and so is the behavior of MOZ_LOG.
| Assignee | ||
Comment 2•1 month ago
|
||
This exposes NSPRLogModulesParser to chrome JS, so that front-end code can
parse MOZ_LOG strings the way the C++ code does, with log modules and options
apart.
| Assignee | ||
Comment 3•1 month ago
|
||
about:logging split the log modules on commas, so it disagreed with MOZ_LOG
on strings such as "Login crypto:5" or "timestamp, nsHttp:5", on log modules
without a level, and on options it didn't know, such as "raw", which it set
as log modules. It now uses the same parser as MOZ_LOG.
| Assignee | ||
Comment 4•1 month ago
|
||
The web-compat preset is rewritten without spaces after ':', which the MOZ_LOG
syntax doesn't allow.
| Assignee | ||
Comment 5•1 month ago
|
||
| Assignee | ||
Comment 6•1 month ago
|
||
Searching for "EME" in the string also enabled logging for EME:0 and for any
module containing EME.
| Assignee | ||
Comment 7•1 month ago
•
|
||
ParseLoggerOptions in js/src/shell/js.cpp is still parsing on its own. Reusing the same parser there means rewriting it without xpcom.
Updated•1 month ago
|
Comment 8•1 month ago
|
||
Comment on attachment 9655956 [details]
WIP: Bug 2078666 - Log the WMF CDM origins list through the console's EME log module. r?#media-playback-reviewers
Revision D331975 was moved to bug 2080173. Setting attachment 9655956 [details] to obsolete.
Description
•