Module Log.Make

Functor that mass-parameterizes a logging function in accordance with configuration C.

Parameters

module C : CONFIG

Signature

exception Unopened

The exception raised when trying to use an unopened log.

val opens : dest -> unit

(opens dest) opens the log dest with mode C.mode.

You must call this function before your first call to log.

val close : unit -> unit

(close ()) closes the log; you don't need to call this if C.flush is true.

val reopen : unit -> unit

(reopen ()) closes and then reopens the log.

Typically used for log rotation.

  • raises Unopened

    if log has never been opened

val log : ?mode:Stdlib.open_flag -> ?level:(unit -> int) -> ?sep:string -> ?quote:(string -> string) option -> ?timestamp:(unit -> string) -> ?myself:string option -> ?pid:(unit -> int) -> ?prefix:string -> ?line:(string -> string) option -> ?flush:bool -> ?exit:int -> int -> ('a, unit, string, unit) Stdlib.format4 -> 'a

(log prio fmt ARGS ...) writes an entry in the log opened via opens with (Format.fprintd fmt ARGS) iff the current log level is (>= prio).

The optional parameters take their defaults from the configuration C, but you can override them if necessary.

Make.log is built on Message.message; see that function for details on the optional parameters.