Topics
Please read important note on debug topics in the comment section of Section debug
Possible improvement
There should be a debug/2 for when one is not interested in passing format parameters at all.
Output
The debug output goes to STDERR (when on a TTY, they are printed in blue)
debug/3 also tries to prepend the output with `%` but only succeeds on the first line!
This should (possibly) be corrected, but in fact it's only meant for one-liners.
However, one can intercept the call and patch in one's own output generator (but I don't know how yet):
?- debug(toplevel). Warning: toplevel: no matching debug topic (yet) true. ?- debug(toplevel,"This is multiline: ~q\n~q\n~q",[alpha,bravo,charlie]). % This is multiline: alpha bravo charlie true.