:-export(bug2/0). bug2:- ... generate_term(Term), analyze_term(Term,Result), ...Suppose we assume that the predicate analyze_term is responsible for a problem. We can then simply add a writeln call before and/or after the predicate call to print out the suspected predicate. The output before that call should show all input arguments, the output after the call should also show the output results.
:-export(bug2/0). bug2:- ... generate_term(Term), writeln(analyze_term(Term,Result)), analyze_term(Term,Result), writeln(analyze_term(Term,Result)), ...Used sparingly for suspected problems, this technique can avoid the use of the debugger and at the same time give a clear indication of the problem. The ECLiPSe system will normally restrict the output of a term to a certain complexity, so that long lists are not printed completely. This can be influenced by the print_depth flag of set_flag.
Such messages can be written to the log_output stream (or a user-defined stream) which can be later be discarded by
set_stream(log_output,null)or which can be directed to a log file. This can be useful in ``live'' code, in order to capture information about problems in failure cases.