Class virtual Cf_journal.T.agent


class virtual ['a #event #archiver] agent : 'a #prioritizer -> 'a -> ('a #event #archiver as 'b) list -> object .. end
The base class for journaling agents. Use inherit agent p v s to derive a subclass that defines the private event_ method to construct an event object with a priority level and a message text using the prioritizer p. Sets the initial priority code minimum to v, and the initial list of archivers to s.

val mutable archivers_ : 'b list
The current list of archivers that journal events from this agent.
val mutable limit_ : Priority.t
The minimum priority code for a diagnostic event to be constructed and passed to the archivers.
method private virtual event : 'a -> string -> ('a #event as 'c)
Define the private event method to construct an event object with a priority level and a message text.
method setlimit : 'a -> unit
Use a#setlimit v to set the minimum priority code to the code corresponding to the priority level v.
method enabled : 'a -> bool
Use a#enabled v to test whether the priority code corresponding to the priority level v is preceded in the total order by the minimum priority code.
method private put : 'd 'e. 'a -> ('c -> 'e) -> ('d, unit, string, 'e) Pervasives.format4 -> 'd
Use this method in level-specific methods of the derived class for constructing events and putting them to archivers. Use super#put v c to construct a function that takes a format string (and arguments thereby specified) and, if self#enabled v returns true then calls self#event v m (where m is the message text given to the continuation provided to Printf.kprintf), iterates on archivers_ invoking the emit method for each one with the constructed event, and finally passing the event to the continuation c. The value returned by c is returned by the method when invoked with a format string (and associated arguments).