module Logger: Logger
type
message = [ `Debug | `Error | `Fatal | `Info | `Warn ] * string
type
size = [ `Kb of int64 | `Mb of int64 | `Unlimited ]
type 'messagetype
t
type
default_t = message t
val create : ?max_size:size ->
?mode:Core.Unix.file_perm ->
?max_archives:[ `Max of int | `Unlimited ] ->
?full_callback:(string Core.Std.Squeue.t -> unit) ->
?filter:('messagetype -> bool) ->
message_to_string:('messagetype -> string) -> string -> 'messagetype t
- max_size - the maximum size of each log file (default 50Mb)
- mode - mode to open the files in
- max_archives - maximum number of archives to keep (default 4)
- full_callback - called when the logger queue backs up so far that log items
may have been lost. Defaults to doing nothing.
- filter - if set, then every message is passed to filter before actually being
logged. If filter returns false the message is dropped.
- message_to_string - called to convert your message type to a string for logging
val create_default : ?max_size:size ->
?mode:Core.Unix.file_perm ->
?max_archives:[ `Max of int | `Unlimited ] ->
?full_callback:(string Core.Std.Squeue.t -> unit) ->
string -> message t
creates a log using the default message type and a filter that drops
`Debug messages
val log : 'messagetype t -> 'messagetype -> unit
logs a message to log
val filter : 'messagetype t -> ('messagetype -> bool) -> unit
Sets the filter for a log
val clear_filter : 'messagetype t -> unit
removes the filter from a log
misc helper functions
val maybe_log : 'messagetype t option -> 'messagetype -> unit
logs a message to Some log, returns silently if log is None
val timestamp : unit -> string
Returns a timestamp as a string suitable for log files