Skip to main content

Module debug

Module debug 

Source
Expand description

Saying something to the person running pmpx.

A plugin cannot print usefully on its own: it does not know the id the host shows for it, whether the person asked for detail, or where those lines should go. So it calls the macros here – debug!, info!, warn!, error! – and the host decides: it adds the prefix and the id, and drops anything louder than the level it was asked for.

Two consequences worth knowing:

  • Nothing is formatted when the host would not print it. Every macro asks wants first, so a run without a trace pays nothing for the lines a plugin writes.
  • The trace is not an input. The plugin always calls the same way; only the host’s printing changes, so a traced run executes byte-for-byte the same command as any other.

Without a host – a plugin’s own cargo test – the messages go to stderr directly, at every level, which is what an author wants while writing a plugin.

Enums§

Level
How loud one message is.

Functions§

context
Print the whole context of the call in progress, as one line.
emit
Send one already-formatted message. The macros go through here.
wants
Whether the host would print a message at this level.