module Tag: sig
.. end
Message tags.
Message tags are arbitrary named and typed values that can be
associated to log messages.
Tag definitions
type 'a
def
The type for tag definitions. The type
'a
is the type of the
tag. The definition specifies a name for the tag, a pretty-printer
for the type of the tag and a documentation string. See
Logs.Tag.def
.
type
def_e =
The type for existential tag definitions.
val def : ?doc:string -> string -> (Format.formatter -> 'a -> unit) -> 'a def
def ~doc name pp
is a tag definition. name
is the name of
the tag, it doesn't need to be unique. pp
is a printer for the
type of the tag. doc
is a documentation string describing
the tag (defaults to "undocumented"
).
val name : 'a def -> string
name d
is d
's name.
val doc : 'a def -> string
doc d
is d
's documentation string.
val printer : 'a def -> Format.formatter -> 'a -> unit
printer d
is d
's type pretty-printer.
val pp_def : Format.formatter -> 'a def -> unit
pp_def ppf d
prints an unspecified representation of d
on ppf
.
val list : unit -> def_e list
tag_list ()
is the list of currently existing tag definitions.
type
t =
The type for tags. Tuples the tag definition and its value.
val pp : Format.formatter -> t -> unit
pp ppf t
prints an unspecified representation of t
on ppf
.
type
set
The type for tag sets. A tag set contains at most one tag per
tag definition.
val empty : set
empty
is the empty set.
val is_empty : set -> bool
is_empty s
is true
iff s
is empty.
val mem : 'a def -> set -> bool
mem d s
is true
iff s
has a tag with definition d
.
val add : 'a def -> 'a -> set -> set
add d v s
is s
with the tag (V (d, v))
added. If there was a tag
with definition d
in s
it is replaced.
val rem : 'a def -> set -> set
rem d s
is s
without the tag defined by d
(if there was one).
val find : 'a def -> set -> 'a option
find d s
is the tag value with definition d
in s
(if any).
val get : 'a def -> set -> 'a
get d s
is like find d s
but
Raises Invalid_argument
if there
is no tag with definition d
in s
.
val fold : (t -> 'a -> 'a) -> set -> 'a -> 'a
fold f s acc
is the result of folding f
over the tags
of s
starting with acc
.
val pp_set : Format.formatter -> set -> unit
pp_set ppf s
prints an unspecified representation of s on ppf
.