Improve message API
Background
Currently, the message API in _context.py
is cumbersome to use, and requires fiddling with a Message
and MessageType
object. This has lead to several re-implementations as helpers in various other locations in the codebase.
It also makes writing quick debug statements hard, and encourages raising exceptions for debugging.
This is annoying!
Task description
We should improve the message API. A first step could be to add helpers such as info()
, error()
, warn()
to _context.py
- this would already help make debugging easier, and be closer to what various logging libraries provide (no need to figure out how to instantiate a Message
again).
We can then think about improving the (currently, mostly unused) --debug
flag to support filtering messages by specific domains.
Excerpt from an IRC discussion on the topic:
<tristan> tlater, I'd like to launch: `bst --debug=sandbox:compose-element build ...`
<tristan> tlater, like that [16:47]
<tristan> and then get debug messages in the logs from the active sandbox implementation, and from statements in the compose element
Acceptance Criteria
We should have a nicer messaging API to make debugging simpler.