print_message/2
hookableprint_message(
+Severity,
+MessageTerm)
Print a Message of a given Severity. The behavior can
be customized using the two hooks generate_message_hook/3
and
message_hook/3
.
message_hook/3
, Severity must be one of
informational
%
warning
*
error
!
help
silent
Messages are parsed according to the definite clause
grammars in qplib('QU_messages')
, which defines
'QU_messages':generate_message/3
. If generate_message(
MessageTerm,
L,[])
is true, the message is printed according to the transformation L;
otherwise, the message is considered to be undefined.
An unhandled exception message E calls print_message(error,
E)
before
returning to the top level. The convention is that an error message is the
result of an unhandled exception. Thus, an error message should only be
printed if raise_exception/1
does not find a handler and unwind to
the top-level.
All messages from the system are printed using this predicate. Means of intercepting these messages before they are printed are provided.
print_message/2
always prints to user_error
. Messages can be
redirected to other streams using message_hook/3
and
print_message_lines/3
"Silent" messages do not get translated or printed. They do not
go through generate_message/3
or generate_message_hook/3
but they can be intercepted with message_hook/3
.
message_hook/3
, generate_message/3
,
print_message_lines/3
, generate_message_hook/3
ref-msg-tbm