Up

module Logging

: sig

Simple logging support

#
type level =
# | Debug
# | Info
# | Warning
#
type time = float
#
type entry = time * exn option * level * string
#
val string_of_level : level -> string
#
val threshold : level Pervasives.ref
#
val will_log : level -> bool
#
val clear_fn : (unit -> unit) option Pervasives.ref
#
type handler = ?ex:exn -> level -> string -> unit
#
val handler : handler Pervasives.ref
#
val log : level -> ?ex:exn -> ('a, unit, string, unit) Pervasives.format4 -> 'a
#
val log_debug : ?ex:exn -> ('a, unit, string, unit) Pervasives.format4 -> 'a
#
val log_info : ?ex:exn -> ('a, unit, string, unit) Pervasives.format4 -> 'a

Write a message to stderr if verbose logging is on.

#
val log_warning : ?ex:exn -> ('a, unit, string, unit) Pervasives.format4 -> 'a

Write a message to stderr, prefixed with "warning: ".

#
val format_argv_for_logging : string list -> string
#
val set_crash_logs_handler : (entry list -> unit) -> unit

If set, record all log messages (at all levels) in memory and dump to this directory on error. Useful for tracking down intermittent bugs.

#
val dump_crash_log : ?ex:exn -> unit -> unit

Dump all recorded log entries to the crash handler set with set_crash_handler. If there is no handler, or the log is empty, does nothing. This is called automatically after logging at level Warning.

end