Printing status and error messages
Author(s): The CLIP Group.
This is a very simple library for printing status and error messages to the console.
Usage and interface
- Library usage:
:- use_module(library(messages)). - Exports:
- Predicates:
error_message/1, error_message/2, error_message/3, warning_message/1, warning_message/2, warning_message/3, note_message/1, note_message/2, note_message/3, simple_message/1, simple_message/2, optional_message/2, optional_message/3, debug_message/1, debug_message/2, debug_goal/2, debug_goal/3, show_message/2, show_message/3, show_message/4. - Regular Types:
message_t/1. - Multifiles:
issue_debug_messages/1.
- Predicates:
- Imports:
- System library modules:
format, lists, write, filenames, compiler/c_itf_internal. - Packages:
prelude, nonpure, assertions, regtypes, isomodes.
- System library modules:
Documentation on exports
Usage:error_message(Text)
Same as message(error,Text).
- The following properties should hold at call time:
(basic_props:string/1)Text is a string (a list of character codes).
Usage:error_message(Text,ArgList)
Same as message(error,Text,ArgList).
- The following properties should hold at call time:
(format:format_control/1)Text is an atom or string describing how the arguments should be formatted. If it is an atom it will be converted into a string with name/2.
(basic_props:list/1)ArgList is a list.
Usage:error_message(Lc,Text,ArgList)
Same as message(error,Lc,Text,ArgList).
- The following properties should hold at call time:
(c_itf_internal:location_t/1)Identifies a source line range in a file.location_t(loc(File,L1,L2)) :- atm(File), int(L1), int(L2).
(format:format_control/1)Text is an atom or string describing how the arguments should be formatted. If it is an atom it will be converted into a string with name/2.
(basic_props:list/1)ArgList is a list.
Usage:warning_message(Text)
Same as message(warning,Text).
- The following properties should hold at call time:
(basic_props:string/1)Text is a string (a list of character codes).
Usage:warning_message(Text,ArgList)
Same as message(warning,Text,ArgList).
- The following properties should hold at call time:
(format:format_control/1)Text is an atom or string describing how the arguments should be formatted. If it is an atom it will be converted into a string with name/2.
(basic_props:list/1)ArgList is a list.
Usage:warning_message(Lc,Text,ArgList)
Same as message(warning,Lc,Text,ArgList).
- The following properties should hold at call time:
(c_itf_internal:location_t/1)Identifies a source line range in a file.location_t(loc(File,L1,L2)) :- atm(File), int(L1), int(L2).
(format:format_control/1)Text is an atom or string describing how the arguments should be formatted. If it is an atom it will be converted into a string with name/2.
(basic_props:list/1)ArgList is a list.
Usage:note_message(Text)
Same as message(note,Text).
- The following properties should hold at call time:
(basic_props:string/1)Text is a string (a list of character codes).
Usage:note_message(Text,ArgList)
Same as message(note,Text,ArgList).
- The following properties should hold at call time:
(format:format_control/1)Text is an atom or string describing how the arguments should be formatted. If it is an atom it will be converted into a string with name/2.
(basic_props:list/1)ArgList is a list.
Usage:note_message(Lc,Text,ArgList)
Same as message(note,Lc,Text,ArgList).
- The following properties should hold at call time:
(c_itf_internal:location_t/1)Identifies a source line range in a file.location_t(loc(File,L1,L2)) :- atm(File), int(L1), int(L2).
(format:format_control/1)Text is an atom or string describing how the arguments should be formatted. If it is an atom it will be converted into a string with name/2.
(basic_props:list/1)ArgList is a list.
Usage:simple_message(Text)
The text provided in Text is printed.
- The following properties should hold at call time:
(basic_props:string/1)Text is a string (a list of character codes).
Usage:simple_message(Text,ArgList)
The text provided in Text is printed as a message, using the arguments in ArgList.
- The following properties should hold at call time:
(format:format_control/1)Text is an atom or string describing how the arguments should be formatted. If it is an atom it will be converted into a string with name/2.
(basic_props:list/1)ArgList is a list.
Usage:optional_message(Text,Opts)
The text provided in Text is printed as a message, but only if the atom -v is a member of Opts. These predicates are meant to be used for optional messages, which are only to be printed when verbose output is requested explicitly.
- The following properties should hold at call time:
(basic_props:string/1)Text is a string (a list of character codes).
(basic_props:list/2)Opts is a list of atms.
Usage:optional_message(Text,ArgList,Opts)
The text provided in Text is printed as a message, using the arguments in ArgList, but only if the atom -v is a member of Opts. These predicates are meant to be used for optional messages, which are only to be printed when verbose output is requested explicitly.
- The following properties should hold at call time:
(format:format_control/1)Text is an atom or string describing how the arguments should be formatted. If it is an atom it will be converted into a string with name/2.
(basic_props:list/1)ArgList is a list.
(basic_props:list/2)Opts is a list of atms.
Usage:debug_message(Text)
The text provided in Text is printed as a debugging message. These messages are turned on by defining a fact of issue_debug_messages/1 with the module name as argument.
- The following properties should hold at call time:
(format:format_control/1)Text is an atom or string describing how the arguments should be formatted. If it is an atom it will be converted into a string with name/2.
Usage:debug_message(Text,ArgList)
The text provided in Text is printed as a debugging message, using the arguments in ArgList to interpret any variable-related formatting commands embedded in Text. These messages are turned on by defining a fact of issue_debug_messages/1 which the module name as argument.
- The following properties should hold at call time:
(format:format_control/1)Text is an atom or string describing how the arguments should be formatted. If it is an atom it will be converted into a string with name/2.
(basic_props:list/1)ArgList is a list.
Usage:debug_goal(Goal,Text)
Goal is called. The text provided in Text is then printed as a debugging message. The whole process (including running Goal) is turned on by defining a fact of issue_debug_messages/1 with the module name as argument.
Usage:debug_goal(Goal,Text,ArgList)
Goal is called. The text provided in Text is then printed as a debugging message, using the arguments in ArgList to interpret any variable-related formatting commands embedded in Text. Note that the variables in ArgList can be computed by Goal. The whole process (including running Goal) is turned on by defining a fact of issue_debug_messages/1 with the module name as argument.
Usage:show_message(Type,Text)
The text provided in Text is printed as a message of type Type.
- The following properties should hold at call time:
(messages:message_t/1)The types of messaes supported by the message predicate
(basic_props:string/1)Text is a string (a list of character codes).
Usage:show_message(Type,Text,ArgList)
The text provided in Text is printed as a message of type Type, using the arguments in ArgList to interpret any variable-related formatting commands embedded in Text.
- The following properties should hold at call time:
(messages:message_t/1)The types of messaes supported by the message predicate
(format:format_control/1)Text is an atom or string describing how the arguments should be formatted. If it is an atom it will be converted into a string with name/2.
(basic_props:list/1)ArgList is a list.
Usage:show_message(Type,Lc,Text,ArgList)
The text provided in Text is printed as a message of type Type, using the arguments in ArgList to interpret any variable-related formatting commands embedded in Text, and reporting error location Lc (file and line numbers).
- The following properties should hold at call time:
(messages:message_t/1)The types of messaes supported by the message predicate
(c_itf_internal:location_t/1)Identifies a source line range in a file.location_t(loc(File,L1,L2)) :- atm(File), int(L1), int(L2).
(format:format_control/1)Text is an atom or string describing how the arguments should be formatted. If it is an atom it will be converted into a string with name/2.
(basic_props:list/1)ArgList is a list.
Documentation on multifiles
(Trust) Usage:issue_debug_messages(Module)
Printing of debugging messages is enabled for module Module.
- The following properties hold upon exit:
(basic_props:atm/1)Module is an atom.
The predicate is of type data.
Known bugs and planned improvements
- Debug message switching should really be done with an expansion, for performance.