:- multifile message_hook/3.
Overrides the call to
A way for the user to intercept the Message of type
Severity, whose translations is Lines, before it is
, ...], where each Linei is of the form
After a message is parsed, but before the message is
If the call to
succeeds without further processing. Otherwise the built-in message
display is used. It is often useful to have a message hook that
performs some action and then fails, allowing other message hooks to
run, and eventually allowing the message to be printed as usual.
See ref-msg-umf-ipm for an example.
An exception raised by this predicate causes
an error message to be printed and then the original message is
printed using the default message text and formatting. Since the user
message_hook/3, they can write code that might raise
The following is the default, built-in message portrayal predicate:
message_hook(MessageTerm,Severity,Lines):- ( Severity == silent -> true /* Don't translate or print silent messages */ ; severity_prefix(Severity,Prefix,Stream) -> print_message_lines(Stream,Prefix,Lines) ; raise_exception(domain_error( print_message(Severity,MessageTerm),1, one_of([help,error,warning, informational,silent]), Severity)). severity_prefix(silent, '', user_error). severity_prefix(help, '', user_error). severity_prefix(error, '! ', user_error). severity_prefix(warning, '* ', user_error). severity_prefix(informational,'% ', user_error).
The reasoning behind the assignment of streams is that all unsolicited output
should go to