gecko-dev/python/mach
Gregory Szorc b3b7dfcfef Bug 1415614 - Add an API to log all structured messages; r=mshal
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
2017-11-09 15:09:52 -08:00
..
docs Bug 1393590 - [mach] Use description field for settings instead of gettext locales, r=gps 2017-08-24 16:17:40 -04:00
mach Bug 1415614 - Add an API to log all structured messages; r=mshal 2017-11-09 15:09:52 -08:00
README.rst Bug 1108399 - Move mach docs into sphinx; r=ahal 2014-12-07 10:40:19 -08:00
bash-completion.sh
setup.py Bug 1399989 - Add python/mach to flake8 linter. r=gps 2017-09-17 22:41:17 -04:00

README.rst

====
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/``.