mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-25 13:51:41 +00:00
b3b7dfcfef
Currently, marking a logger as a structured logger will require a subsequent function call in order for the logger to be hooked up to active handlers. This behavior is not intuitive and makes it easy to not have handlers for newly-registered loggers. This means messages may not be logged anywhere. In addition, we have to manually specify which named loggers to enable structured logging for. This can be annoying. We change the behavior of register_structured_logger() to automatically add existing terminal and json handlers to the logger being marked as structured. We also introduce an API to enable structured logging for all loggers. Existing consumers of registered_structured_logger() in mozbuild have been updated to use this API. A new consumer has been added for the `mach configure` command because it should have been there before. We stop short of making enable_all_structured_loggers() the default. This is because various commands interact with the log manager in ways that will result in duplicate logging of messages and dropping of structured messages. There is a bit of a rabbit hole here and addressing it can be done as a follow-up. MozReview-Commit-ID: 1aU6eJvTSMP --HG-- extra : rebase_source : 2a0a569b378cc3083b55fc7076b291abdfb7453f |
||
---|---|---|
.. | ||
docs | ||
mach | ||
bash-completion.sh | ||
README.rst | ||
setup.py |
==== mach ==== Mach (German for *do*) is a generic command dispatcher for the command line. To use mach, you install the mach core (a Python package), create an executable *driver* script (named whatever you want), and write mach commands. When the *driver* is executed, mach dispatches to the requested command handler automatically. To learn more, read the docs in ``docs/``.