Did you know ... Search Documentation:
Pack prolog_library_collection -- prolog/debug_ext.pl
PublicShow source
 dcg_debug(+Flag, :Dcg_0) is det
Write the first generation of Dcg_0 as a debug message under the given Flag.
 debug_call(+Flag:compound, :Goal_0) is det
 debug_dict(+Flag:compound, +Dict:dict) is det
 debug_phrase(+Flag:compound, :Dcg_0) is det
 debug_time(+Flag:compound, +Message:string) is det
 format_debug(+Flag:term, +Format:string) is det
 format_debug(+Flag:term, +Format:string, +Args:list(term)) is det
 format_debug(+Flag:term, +Out:ostream, +Format:string, +Arguments:list(term)) is det
Allows a line of text to be written to an output stream and -- optionally -- to a debug stream as well.

Format’ and ‘Arguments’ are used to compose a line of text. The newline character is automatically added at the end.

Debug information is displayed by calling ‘debug(Flag)’ (see library ‘debug’). ‘Flag’ can be an atom or a compound term.

 format_interval(+Index:nonneg, +Interval:nonneg) is det
 format_interval(+Index:nonneg, +Interval:nonneg, +Out, +Format:atom, +Argumentss:list) is det
Only emit a message with a certain interval.
 indent_debug(+Mode:oneof([-1,0,1]), +Flag:compound, +Format:string) is det
 indent_debug(+Mode:oneof([-1,0,1]), +Flag:compound, +Format:string, +Args:list(term)) is det
 json_write_debug(+Flag:term, +Dict:dict) is det
 json_write_debug(+Flag:term, +Out:ostream, +Dict:dict) is det

Re-exported predicates

The following predicates are re-exported from other modules

 debug(+Topic, +Format, :Args) is det
Format a message if debug topic is enabled. Similar to format/3 to user_error, but only prints if Topic is activated through debug/1. Args is a meta-argument to deal with goal for the @-command. Output is first handed to the hook prolog:debug_print_hook/3. If this fails, Format+Args is translated to text using the message-translation (see print_message/2) for the term debug(Format, Args) and then printed to every matching destination (controlled by debug/1) using print_message_lines/3.

The message is preceded by '% ' and terminated with a newline.

See also
- format/3.
 debug(+Topic) is det
 nodebug(+Topic) is det
Add/remove a topic from being printed. nodebug(_) removes all topics. Gives a warning if the topic is not defined unless it is used from a directive. The latter allows placing debug topics at the start of a (load-)file without warnings.

For debug/1, Topic can be a term Topic > Out, where Out is either a stream or stream-alias or a filename (atom). This redirects debug information on this topic to the given output.

 debug(+Topic) is det
 nodebug(+Topic) is det
Add/remove a topic from being printed. nodebug(_) removes all topics. Gives a warning if the topic is not defined unless it is used from a directive. The latter allows placing debug topics at the start of a (load-)file without warnings.

For debug/1, Topic can be a term Topic > Out, where Out is either a stream or stream-alias or a filename (atom). This redirects debug information on this topic to the given output.

 debugging(+Topic) is semidet
debugging(-Topic) is nondet
 debugging(?Topic, ?Bool) is nondet
Examine debug topics. The form debugging(+Topic) may be used to perform more complex debugging tasks. A typical usage skeleton is:
      (   debugging(mytopic)
      ->  <perform debugging actions>
      ;   true
      ),
      ...

The other two calls are intended to examine existing and enabled debugging tokens and are typically not used in user programs.

 debugging(+Topic) is semidet
debugging(-Topic) is nondet
 debugging(?Topic, ?Bool) is nondet
Examine debug topics. The form debugging(+Topic) may be used to perform more complex debugging tasks. A typical usage skeleton is:
      (   debugging(mytopic)
      ->  <perform debugging actions>
      ;   true
      ),
      ...

The other two calls are intended to examine existing and enabled debugging tokens and are typically not used in user programs.

 list_debug_topics is det
List currently known debug topics and their setting.
 debug_message_context(+What) is det
Specify additional context for debug messages.
deprecated
- New code should use the Prolog flag message_context. This predicates adds or deletes topics from this list.
 assertion(:Goal) is det
Acts similar to C assert() macro. It has no effect if Goal succeeds. If Goal fails or throws an exception, the following steps are taken:
  • call prolog:assertion_failed/2. If prolog:assertion_failed/2 fails, then:
    • If this is an interactive toplevel thread, print a message, the stack-trace, and finally trap the debugger.
    • Otherwise, throw error(assertion_error(Reason, G),_) where Reason is one of fail or the exception raised.

Undocumented predicates

The following predicates are exported, but not or incorrectly documented.

 format_debug(Arg1, Arg2, Arg3)
 format_debug(Arg1, Arg2, Arg3, Arg4)
 format_interval(Arg1, Arg2, Arg3, Arg4, Arg5)
 indent_debug(Arg1, Arg2, Arg3, Arg4)
 json_write_debug(Arg1, Arg2, Arg3)