Module Mavryk_base_unix.Internal_event_unix

Configure the event-logging framework for UNIX-based applications.

The JSON-file-friendly definition of the configuration of the internal-events framework. It allows one to activate registered event sinks.

module Configuration : sig ... end
val env_var_name : string

This is the environment variable name that contains the a list of URIs on which events can be reported (see init).

val close : unit -> unit Lwt.t

Call close on all the sinks.

val make_with_defaults : ?verbosity:Mavryk_event_logging.Internal_event.level -> ?enable_default_daily_logs_at:string -> ?daily_logs_section_prefixes: (string * Mavryk_event_logging.Internal_event.level) list -> ?log_cfg:Logs_simple_config.cfg -> unit -> Mavryk_base.Internal_event_config.t

make_defaults ?verbosity ?enable_default_daily_logs_at ?daily_logs_section_prefixes ?internal_events creates internal event configuration using default values depending on parameters.

  • verbosity overrides the default level on stdout. Usually provided through -v instead of configuration.
  • If internal_events is provided, nothing is modified. Otherwise default values are used.
  • enable_default_daily_logs_at adds daily rotating sink at the given path with the following value: "file-descriptor-path:///<daily_logs_path>/daily.log ?create-dirs=true&daily-logs=7&section-prefix=info&format=pp"

This function handles MAVRYK_LOG environment variables and rules provided through it. It also optionally accepts ?daily_logs_section_prefixes.

val init : ?config:Mavryk_base.Internal_event_config.t -> unit -> unit Lwt.t

init ?config () initializes the internal-event sinks using either

  • "MAVRYK_EVENTS_CONFIG" environment variable,
  • config, the value of configured sinks of command calling init, if provided,

Note that if config is provided,the environment variable MAVRYK_LOG is ignored.

"MAVRYK_EVENTS_CONFIG" is expected to be a (whitespace separated) list of URIs. If an URI does not have a scheme it is expected to be a path to a configuration JSON file (cf. Configuration.of_file), e.g.: export MAVRYK_EVENTS_CONFIG="unix-files:///tmp/events-unix debug://", or export MAVRYK_EVENTS_CONFIG="debug:// /path/to/config.json".

val enable_default_daily_logs_at : daily_logs_path:string -> unit Mavryk_base.TzPervasives.Error_monad.tzresult Lwt.t

Adds a daily rotating sink at the given path with the following value: "file-descriptor-path:///<daily_logs_path>/daily.log ?create-dirs=true&daily-logs=7&section-prefix=info&format=pp"