built-in method

before/3

Description

before(Object, Message, Sender)

User-defined method for handling before events. This method is declared in the monitoring built-in protocol as a public predicate and automatically called by the runtime for messages sent using the (::)/2 control construct from within objects compiled with the events flag set to allow.

Note that you can make this predicate scope protected or private by using, respectively, protected or private implementation of the monitoring protocol.

Modes and number of proofs

before(?object_identifier, ?callable, ?object_identifier) - zero_or_more

Errors

(none)

Examples

:- object(...,
    implements(monitoring),
    ...).

    % write a log message when a message is sent:
    before(Object, Message, Sender) :-
        writeq(Object), write('::'), writeq(Message),
        write(' from '), writeq(Sender), nl.