Module Logger
module Logger:Logging of formatted messages.sig..end
This module provides helper functions for message logging with varying log levels. A logging priority can be set to filter out messages with log level below the priority. This module follows the standard C library's system logging primitives (see syslog(3)) for naming and usage of log levels.
Messages are formatted with the standard OCaml pretty-printing facility
provided in the module Format of the standard library. Logging functions
in this module have the same type as Format.printf.
Error messages are output to standard error. All other messages are output to standard output.
The default priority is set to Notice so that by default all messages are
logged except debug and informational messages.
type log_level =
| |
Error |
(* | Error messages | *) |
| |
Report |
(* | Important messages (e.g. results) | *) |
| |
Warning |
(* | Warning messages | *) |
| |
Notice |
(* | Normal but significant messages | *) |
| |
Info |
(* | Informational messages | *) |
| |
Trace |
(* | Tracing messages | *) |
| |
Debug |
(* | Debug messages | *) |
val log : log_level -> ('a, Format.formatter, unit) format -> 'alog level format arg1 ... argN either does nothing if level is strictly
below the current priority, or formats the arguments arg1 to argN
to format and outputs the resulting string otherwise. The output channel
is stderr if level is Error and stdout otherwise.val slog : log_level -> ('a, Format.formatter, unit) format -> 'aslog level format arg1 ... argN either does nothing if level is distinct
from the current priority, or formats the arguments arg1 to argN to
format and outputs the resulting string otherwise. The output channel is
stderr if level is Error and stdout otherwise.val error : ('a, Format.formatter, unit) format -> 'a
Same as
log Error.val report : ('a, Format.formatter, unit) format -> 'a
Same as
log Report.val warning : ('a, Format.formatter, unit) format -> 'a
Same as
log Warning.val notice : ('a, Format.formatter, unit) format -> 'a
Same as
log Notice.val info : ('a, Format.formatter, unit) format -> 'a
Same as
log Info.val trace : ('a, Format.formatter, unit) format -> 'a
Same as
log Trace.val debug : ('a, Format.formatter, unit) format -> 'a
Same as
log Debug.val set_priority : log_level -> unitset_priority level sets the current priority to level.val flush : unit -> unitflush () flushes all formatters used by this module.