Module Easy_logging.HandlersSource

Default implementation of a Handlers module.

This is the Handlers module. It provides simple yet adaptable handlers implementation.

Sourcetype log_formatter = Easy_logging__.Logging_types.log_item -> string

Type definitions

Sourcetype filter = Easy_logging__.Logging_types.log_item -> bool
Sourcetype t = {
  1. mutable fmt : log_formatter;
  2. mutable level : Easy_logging__.Logging_types.level;
  3. mutable filters : filter list;
  4. output : string -> unit;
}

Type of a handler

A handler is made of:

Handlers creation helpers

Sourcemodule CliHandler : sig ... end

Module to create handlers that output to stdout or stderr.

Sourcemodule FileHandler : sig ... end

Module to create handlers that output to a file.

Sourcetype config = {
  1. file_handlers : FileHandler.config;
}
Sourceval default_config : config
Sourcetype desc =
  1. | Cli of Easy_logging__.Logging_types.level
  2. | CliErr of Easy_logging__.Logging_types.level
  3. | File of string * Easy_logging__.Logging_types.level
  4. | RotatingFile of string * Easy_logging__.Logging_types.level * int * int
Sourceval make : ?config:config -> desc -> t

Used for quick handler creation, e.g.

Handlers setup

Sourceval set_level : t -> Easy_logging__.Logging_types.level -> unit

Sets the level of a handler.

Sourceval set_formatter : t -> log_formatter -> unit

Sets the formatter of a handler.

Sourceval add_filter : t -> filter -> unit

Adds a filter to a handler.

Sourceval apply : t -> Easy_logging__.Logging_types.log_item -> unit

Auxiliary function.