On 2/6/21 5:40 AM, Andrew Jones wrote:
BTW is there some easy way to dump QMP traffic on stdio?
You can use scripts/qmp/qmp-shell to manually test stuff.
Thanks,
drew
If you enable debug logging in python too, it'll print to STDERR. This
may or may not be useful depending on how the library is getting used
and by whom.
(For iotests, you used to be able to engage this mode by passing -d. I
don't know if the new test runner has changed this behavior. I'm sure
avocado has something similar, somewhere, too.)
Otherwise, the runes are something like:
```
import logging
logging.basicConfig(level=logging.DEBUG)
```
but this only works once per process; the iotests entry point already
has a call like this. To override it:
```
import logging
logging.getLogger().setLevel(logging.DEBUG)
```
There are other, more complex incantations; you can read
https://docs.python.org/3/howto/logging.html if you'd like; the logger
we care about is "QMP" (for QMP instances created without a 'nickname')
and "QMP.{nickname}" for ones that were. So you can do this:
logging.getLogger("QMP").setLevel(logging.DEBUG)
but you might need to adjust other settings to get it to appear on
STDERR (I don't remember), like setting handler propagation settings and
so on.
--js