/*----------------------------------------------------------
                         MONITORING
----------------------------------------------------------*/


%%% verbose
%%% =======
%%%
%%%     Predicate governs the degree of verbosity in the
%%%     notifications. 

:- dynamic verbose/0.


%%% notify_...(...)
%%% ===============
%%%
%%%     Prints debugging information if the flag verbose/0
%%%     is true. 

notify_consequence(RuleName, Trigger, Others, 
                   SideConds, Consequent) :-
    ( verbose ->
        format("~p:~n    trigger: ~p~n", 
               [RuleName, Trigger]),
	format("   others: ~p~n", [Others]),
        format("   side conds: ~p~n", [SideConds]),
        format("   cons:    ~p~n", [Consequent])
    ; true ).


notify_agenda_addition(Item) :-
    (verbose 
        -> (format('~NAdding to agenda: <-> ~p~n', [Item]))
        ;  (print('.'), ttyflush)).


notify_chart_addition(Index) :-
    index_to_item(Index, Item),
    item_to_key(Item, Key),
    (verbose 
        -> (format('~NAdding to chart: <~p> ~p~n',
                   [Key,Item])) 
        ;  (print(':'), ttyflush)).
