package easy_logging_yojson

  1. Overview
  2. Docs

Module Easy_logging_yojson.HandlersSource

include module type of struct include Easy_logging.Handlers end
Sourcetype log_formatter = Easy_logging__.Logging_types.log_item -> string

Type definitions

Sourcetype filter = Easy_logging__.Logging_types.log_item -> bool
Sourcetype t = Easy_logging.Handlers.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:

  • a formatter that transforms a log item into a string.
  • a level used to filter out items.
  • an array of possible additional custom filters.
  • an output function, that takes a string and does the output job.

Handlers creation helpers

Module to create handlers that output to stdout or stderr.

Module to create handlers that output to a file.

Sourcetype config = Easy_logging.Handlers.config = {
  1. file_handlers : FileHandler.config;
}
Sourceval default_config : config
Sourcetype desc = Easy_logging.Handlers.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.

  • Cli handler: outputs colored messages to stdout

     let h = Handlers.make (Cli Debug) 
  • File handler : outputs messages to a given file

     let h = Handlers.make (File ("filename", Debug)) 

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.

Sourcemodule FileHandlers : sig ... end
Sourcetype config_ = Easy_logging.Handlers.config = {
  1. file_handlers : FileHandlers.config;
}
Sourceval config__to_yojson : config_ -> Yojson.Safe.t
Sourceval config_to_yojson : config_ -> Yojson.Safe.t
Sourcetype cli_json_params = {
  1. level : Easy_logging__.Logging_types.level;
}
Sourceval cli_json_params_to_yojson : cli_json_params -> Yojson.Safe.t
Sourcetype cli_json_desc = {
  1. cli : cli_json_params;
}
Sourceval cli_json_desc_to_yojson : cli_json_desc -> Yojson.Safe.t
Sourcetype cli_err_json_desc = {
  1. cli_err : cli_json_params;
}
Sourceval cli_err_json_desc_to_yojson : cli_err_json_desc -> Yojson.Safe.t
Sourcetype file_json_desc_params = {
  1. filename : string;
  2. level : Easy_logging__.Logging_types.level;
}
Sourceval file_json_desc_params_to_yojson : file_json_desc_params -> Yojson.Safe.t
Sourcetype file_json_desc = {
  1. file : file_json_desc_params;
}
Sourceval file_json_desc_to_yojson : file_json_desc -> Yojson.Safe.t
Sourcetype rotating_file_json_desc_params = {
  1. filename : string;
  2. level : Easy_logging__.Logging_types.level;
  3. max_kb : int;
  4. backup_count : int;
}
Sourceval rotating_file_json_desc_params_to_yojson : rotating_file_json_desc_params -> Yojson.Safe.t
Sourcetype rotating_file_json_desc = {
  1. rotating_file : rotating_file_json_desc_params;
}
Sourceval rotating_file_json_desc_to_yojson : rotating_file_json_desc -> Yojson.Safe.t
Sourceval desc_of_yojson : Yojson.Safe.t -> (desc, string) result
Sourceval desc_to_yojson : desc -> Yojson.Safe.t
OCaml

Innovation. Community. Security.