package easy_logging

  1. Overview
  2. Docs

Attributes

val name : string

Name of the logger, displayed in log messages

val mutable levelo : log_level option

Value used to filter log messages. If levelo is None, no message is outputed.

type log_level = | Debug | Info | Warning | Error | Flash 
val mutable handlers : Default_handlers.t list

Registered handlers for this logger

Classic logging Methods

Each of these methods takes an optional tag list and a string as an input. If the log level of the instance is low enough, a log item will be created theb passed to the handlers.

Example :

logger#warning "Something wrong happened"
method debug : ?tags:Default_handlers.tag list -> string -> unit
method info : ?tags:Default_handlers.tag list -> string -> unit
method warning : ?tags:Default_handlers.tag list -> string -> unit
method error : ?tags:Default_handlers.tag list -> string -> unit
method flash : ?tags:Default_handlers.tag list -> string -> unit

Lazy logging methods

Each of these methods takes a string lazy_t as an input (as well as the optional tag list. If the log level of the instance is low enough, the lazy value will forced into a string, a log item will be created then passed to the handlers.

Example:

logger#ldebug (lazy (heavy_calculation () ))
method ldebug : ?tags:Default_handlers.tag list -> string lazy_t -> unit
method linfo : ?tags:Default_handlers.tag list -> string lazy_t -> unit
method lwarning : ?tags:Default_handlers.tag list -> string lazy_t -> unit
method lerror : ?tags:Default_handlers.tag list -> string lazy_t -> unit
method lflash : ?tags:Default_handlers.tag list -> string lazy_t -> unit

Other methods

method add_handler : Default_handlers.t -> unit

Adds a handler to the logger instance.

method set_level : log_level option -> unit

Sets the log level of the logger instance.

OCaml

Innovation. Community. Security.