package tezos-event-logging

  1. Overview
  2. Docs

Error_event.t is a generic event to emit values of type Error_monad.errorlist.

type t = {
  1. message : string option;
  2. severity : [ `Fatal | `Recoverable ];
  3. trace : Tezos_error_monad.Error_monad.error list;
}

Errors mainly store Error_monad.errorlist values. One can attach a message and a severity (the default is `Recoverable which corresponds to the Error level, while `Fatal corresponds to Fatal).

val make : ?message:string -> ?severity:[ `Fatal | `Recoverable ] -> Tezos_error_monad.Error_monad.error list -> unit -> t
include EVENT with type t := t
include EVENT_DEFINITION with type t := t
val section : Section.t option

Defines an optional section for the event.

Warning None is only for legacy events and should not be used in new code.

val name : string

Defines the identifier for the event. Names should be unique and are restricted to alphanumeric characters or ".@-_+=,~".

val doc : string

A display-friendly text which describes what the event means.

val pp : short:bool -> Format.formatter -> t -> unit
val encoding : t Data_encoding.t
val level : t -> level

Return the preferred level for a given event instance.

val emit : ?section:Section.t -> (unit -> t) -> unit Tezos_error_monad.Error_monad.tzresult Lwt.t

Output an event of type t, if no sinks are listening the function won't be applied.

val log_error_and_recover : ?section:Section.t -> ?message:string -> ?severity:[ `Fatal | `Recoverable ] -> (unit -> (unit, Tezos_error_monad.Error_monad.error list) result Lwt.t) -> unit Lwt.t

log_error_and_recover f calls f () and emits an Error_event.t event if it results in an error. It then continues in the _ Lwt.t monad (e.g. there is no call to Lwt.fail).

OCaml

Innovation. Community. Security.