11.3.155 print_message_lines/3

Synopsis

print_message_lines(+Stream, +Severity, +Lines)

Print the Lines to Stream, preceding each line with a prefix corresponding to Severity.

Arguments

Stream
stream_object, must be ground

Any valid output stream.

Severity
one of [query,help,informational,warning,error,silent,term]
Lines
list of list of pair

Must be of the form [Line1, Line2, ...], where each Linei must be of the form [Control_1-Args_1,Control_2-Args_2, ...].

Description

If Severity is a valid severity, the prefix will be as described for print_message/2, otherwise Severity itself will be used as the prefix. If Severity is query, no newline is written after the last line (otherwise, a newline is written).

This predicate is intended to be used in conjunction with user:message_hook/3. After a message is intercepted using user:message_hook/3, this command is used to print the lines. If the hook has not been defined, the arguments are those provided by the system.

Exceptions

Stream errors (see ref-iou-sfh-est), plus:

instantiation_error
type_error
in Lines.

Examples

Suppose you want to intercept messages and force them to go to a different stream:

     user:message_hook(Severity, Message, Lines):-
         my_stream(MyStream),
         print_message_lines(MyStream, Severity, Lines).

See Also

ref-msg.


Send feedback on this subject.