Message Printing Phase

By default this phase is handled by the built-in predicate print_message_lines/3. Each line of the message is prefixed with a string depending on the severity, and is printed to user_error. The query severity is special—no newline is printed after the last line of the message.

This behavior can be overridden by defining the hook predicate message_hook/3, which is called with the severity of the message, the abstract message term and its translation to format-command lines. It can be used to make smaller changes, for example by calling print_message_lines/3 with a stream argument other than user_error, or to implement a totally different display method such as using dialog windows for messages.

For messages of the severity silent the message printing phase consists of calling the hook predicate message_hook/3 only. Even if the hook fails, no printing is done.

Send feedback on this subject.