:- module(dbug,[dbug/0,dbug/1,dbug/2,nodbug/0]). :- dynamic dbugging/0. % dbug/0 turns on dbug messages. dbug :- dbugging -> true; assert(dbugging). % dbug(FormatString) defaults the Arguments to []. dbug(FormatString) :- dbug(FormatString,[]). % dbug(FS, Args) prints a message if dbugging is on. dbug(FormatString,Args) :- dbugging -> format(FormatString,Args); true. % nodbug/0 turns off dbug messages. nodbug :- retract(dbugging) -> true; true. % dbugging is off initially. :- nodbug.