package easy_logging

  1. Overview
  2. Docs
Module to log messages. Aimed at being both powerful and easy to use

Install

Dune Dependency

Authors

Maintainers

Sources

v0.8.2.tar.gz
md5=467a966433b97693e0c226a90b9b833e
sha512=d4b97a29225c454a2d8ed04495aa7ecd3b012d7258372be2450e9b672498ba24ce9a3079307e762e12948661bc1e104a90f167fabf60c212fe67b13d6c4edf51

doc/easy_logging/Easy_logging/Logging/class-logger/index.html

Class Logging.loggerSource

Attributes

val name : string

Name of the logger:

  • can be displayed in log messages.
  • defines the logger place in the logging tree.
val mutable level : level

Value used to filter log messages.

val mutable handlers : Easy_logging__.Handlers.t list

Registered handlers for this logger.

val parent : logger option

The optional parent of this logger.

val propagate : bool

Whether messages passed to this logger are propagated to its ancestors' handlers.

val mutable tag_generators : (unit -> string) list

The list of functions used for dynamic tagging of messages.

Getters and setters

method name : string

Returns the logger name.

method set_level : level -> unit

Sets the log level of the logger instance.

method add_handler : Easy_logging__.Handlers.t -> unit

Adds a handler to the logger instance.

method get_handlers : Easy_logging__.Handlers.t list
method set_handlers : Easy_logging__.Handlers.t list -> unit
method add_tag_generator : (unit -> string) -> unit

Will add a tag to each log message, resulting from the call of the supplied fonction (called each time a message is logged)

method set_propagate : bool -> unit

Sets the propagate attribute, which decides whether messages passed to this logger are propagated to its ancestors' handlers.

method get_handlers_propagate : Easy_logging__.Handlers.t list

Returns the list of handlers of the logger, recursing with parents handlers if propagate is true

method effective_level : level

Returns this logger level if it is not None, else searches amongst ancestors for the first defined level; returns NoLevel if no level can be found.

method internal_level : level

Returns the logger internal level.

Classic logging Methods

Each of these methods takes an optional string list of tags, then a set of parameters the way a printf function does. If the log level of the instance is low enough, a log item will be created theb passed to the handlers.

Example :

logger#warning "Unexpected value: %s" (to_string my_value)
method flash : 'a. ?tags:string list -> ('a, unit, string, unit) format4 -> 'a
method error : 'a. ?tags:string list -> ('a, unit, string, unit) format4 -> 'a
method warning : 'a. ?tags:string list -> ('a, unit, string, unit) format4 -> 'a
method info : 'a. ?tags:string list -> ('a, unit, string, unit) format4 -> 'a
method trace : 'a. ?tags:string list -> ('a, unit, string, unit) format4 -> 'a
method debug : 'a. ?tags:string list -> ('a, unit, string, unit) format4 -> 'a

Lazy logging methods

Each of these methods takes a string lazy_t as an input (as well as the optional tags. 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:string list -> string lazy_t -> unit
method ltrace : ?tags:string list -> string lazy_t -> unit
method linfo : ?tags:string list -> string lazy_t -> unit
method lwarning : ?tags:string list -> string lazy_t -> unit
method lerror : ?tags:string list -> string lazy_t -> unit
method lflash : ?tags:string list -> string lazy_t -> unit

String logging methods

Each of these methods takes a string as an input (as well as the optional tags).

Example:

logger#sdebug string_variable
method sdebug : ?tags:string list -> string -> unit
method strace : ?tags:string list -> string -> unit
method sinfo : ?tags:string list -> string -> unit
method swarning : ?tags:string list -> string -> unit
method serror : ?tags:string list -> string -> unit
method sflash : ?tags:string list -> string -> unit
OCaml

Innovation. Community. Security.