The predicate print_message2 may be used to print a message term in a human readable format. The other predicates from this section allow the user to refine and extend the message system. The most common usage of print_message2 is to print error messages from exceptions. The code below prints errors encountered during the execution of Goal, without further propagating the exception and without starting the debugger.
Another common use is to defined message_hook3 for printing messages that are normally silent, suppressing messages, redirecting messages or make something happen in addition to printing the message.
This predicate first translates the Term into a list of `message lines' (see print_message_lines3 for details). Next it will call the hook message_hook3 to allow the user intercepting the message. If message_hook3 fails it will print the message unless Kind is silent.
The print_message2 predicate and its rules are in the file plhome/boot/messages.pl, which may be inspected for more information on the error messages and related error terms.
print_message_lines3+Stream, +Prefix, +Lines Print a message (see print_message2) that has been translated to a list of message elements. The elements of this list are:
~N).
Format
Handed to format3 as format(Stream, Format, []).
nl
A new line is started and if the message is not complete
the Prefix is printed too.
See also print_message2 and message_hook3.
message_hook3+Term, +Kind, +Lines Hook predicate that may be define in the module user to intercept messages from print_message2. Term and Kind are the same as passed to print_message2. Lines is a list of format statements as described with print_message_lines3. See also message_to_string2.
This predicate should be defined dynamic and multifile to allow other modules defining clauses for it too.
message_to_string2+Term, -String Translates a message-term into a string object (see string. Primarily intended to write messages to Windows in XPCE (see xpce) or other GUI environments.