Structured_log_eventsThe type of structured log events.
New structured log events may be registered using the @@deriving register_event ppx. A new structured log event is a constructor of this type with either an inline record argument or no arguments. For example: {
t += Ctor1 of {a:int; b:string; c:M.t}
[@@deriving register_event
{msg= "Optional log message, possibly including $a, $b, and $c"}]
t += Ctor2 [@@deriving register_event]
}
val id_to_yojson : id -> Yojson.Safe.tval id_of_yojson : Yojson.Safe.t -> id Ppx_deriving_yojson_runtime.error_orval sexp_of_id : id -> Ppx_sexp_conv_lib.Sexp.tval id_of_sexp : Ppx_sexp_conv_lib.Sexp.t -> idval id_of_string : string -> idCreate an identifier for a structured log event. This is for internal use by the @@deriving register_event ppx.
val string_of_id : id -> stringRetrieve the string representation of a structured log event. id_of_string (string_of_id id) = id
type repr = {id : id; |
event_name : string; |
arguments : Core_kernel.String.Set.t; |
log : t -> (string * (string * Yojson.Safe.t) list) option; |
parse : (string * Yojson.Safe.t) list -> t option; |
}The representation of a structured log event, used to convert the events to and from log messages. This is automatically generated by the @@deriving register_event ppx.
val register_constructor : repr -> unitRegister a structured log event's representation. This is for internal use by the @@deriving register_event ppx.
Convert a structured log message into JSON content for logging. log (Event_name {field_name1= field_value1; ...}) returns (log_message, log_event_id, [(field_name1, field_value1); ...]), where the log message and ID are defined by @@deriving register_event.
Parse a log message as a structured log event.
val dump_registered_events : unit -> (string * id * string list) listReturns a list of the registered events, in the form (event_name, event_id, event_field_names).