2016-09-08 21:13:10 +04:00
|
|
|
(**************************************************************************)
|
|
|
|
(* *)
|
2018-02-06 00:17:03 +04:00
|
|
|
(* Copyright (c) 2014 - 2018. *)
|
2016-09-08 21:13:10 +04:00
|
|
|
(* Dynamic Ledger Solutions, Inc. <contact@tezos.com> *)
|
|
|
|
(* *)
|
|
|
|
(* All rights reserved. No warranty, explicit or implicit, provided. *)
|
|
|
|
(* *)
|
|
|
|
(**************************************************************************)
|
|
|
|
|
2018-06-14 02:22:17 +04:00
|
|
|
(** Unique tag for a logging module.
|
|
|
|
Match against, e.g. `Logging.Core.Section`. *)
|
2018-06-08 05:17:23 +04:00
|
|
|
type log_section = private ..
|
|
|
|
|
|
|
|
type log_message = {
|
|
|
|
section : log_section ;
|
|
|
|
text : string ;
|
|
|
|
tags : Tag.set ;
|
|
|
|
}
|
|
|
|
|
2018-06-14 02:22:17 +04:00
|
|
|
type tap_id
|
|
|
|
|
|
|
|
(** Intercept events as they are logged. All events will generate a call to
|
|
|
|
your tap function, but `text` will only be included for events that
|
|
|
|
actually print a message according to the active logging configuration. *)
|
|
|
|
val tap : (log_message -> unit) -> tap_id
|
|
|
|
|
|
|
|
(** Remove a previously set tap by supplying its tap_id. Does nothing if
|
|
|
|
the tap was removed already. *)
|
|
|
|
val untap : tap_id -> unit
|
2018-06-08 05:17:23 +04:00
|
|
|
|
|
|
|
type ('a,'b) msgf = (('a, Format.formatter, unit, 'b) format4 -> ?tags:Tag.set -> 'a) -> ?tags:Tag.set -> 'b
|
|
|
|
type ('a,'b) log = ('a,'b) msgf -> 'b
|
|
|
|
|
|
|
|
module type MESSAGE = sig
|
|
|
|
val name: string
|
|
|
|
end
|
|
|
|
|
|
|
|
module type SEMLOG = sig
|
|
|
|
|
|
|
|
type log_section += Section
|
|
|
|
|
|
|
|
module Tag = Tag
|
|
|
|
|
|
|
|
val debug: ('a, unit) log
|
|
|
|
val log_info: ('a, unit) log
|
|
|
|
val log_notice: ('a, unit) log
|
|
|
|
val warn: ('a, unit) log
|
|
|
|
val log_error: ('a, unit) log
|
|
|
|
val fatal_error: ('a, unit) log
|
|
|
|
|
|
|
|
val lwt_debug: ('a, unit Lwt.t) log
|
|
|
|
val lwt_log_info: ('a, unit Lwt.t) log
|
|
|
|
val lwt_log_notice: ('a, unit Lwt.t) log
|
|
|
|
val lwt_warn: ('a, unit Lwt.t) log
|
|
|
|
val lwt_log_error: ('a, unit Lwt.t) log
|
|
|
|
val lwt_fatal_error: ('a, unit Lwt.t) log
|
|
|
|
|
|
|
|
val event : string Tag.def
|
|
|
|
val exn : exn Tag.def
|
|
|
|
|
|
|
|
end
|
|
|
|
|
2016-09-08 21:13:10 +04:00
|
|
|
module type LOG = sig
|
|
|
|
|
2018-06-08 05:17:23 +04:00
|
|
|
type log_section += Section
|
|
|
|
|
2016-09-08 21:13:10 +04:00
|
|
|
val debug: ('a, Format.formatter, unit, unit) format4 -> 'a
|
|
|
|
val log_info: ('a, Format.formatter, unit, unit) format4 -> 'a
|
|
|
|
val log_notice: ('a, Format.formatter, unit, unit) format4 -> 'a
|
|
|
|
val warn: ('a, Format.formatter, unit, unit) format4 -> 'a
|
|
|
|
val log_error: ('a, Format.formatter, unit, unit) format4 -> 'a
|
2017-11-08 19:02:19 +04:00
|
|
|
val fatal_error: ('a, Format.formatter, unit, unit) format4 -> 'a
|
2016-09-08 21:13:10 +04:00
|
|
|
|
|
|
|
val lwt_debug: ('a, Format.formatter, unit, unit Lwt.t) format4 -> 'a
|
|
|
|
val lwt_log_info: ('a, Format.formatter, unit, unit Lwt.t) format4 -> 'a
|
|
|
|
val lwt_log_notice: ('a, Format.formatter, unit, unit Lwt.t) format4 -> 'a
|
|
|
|
val lwt_warn: ('a, Format.formatter, unit, unit Lwt.t) format4 -> 'a
|
|
|
|
val lwt_log_error: ('a, Format.formatter, unit, unit Lwt.t) format4 -> 'a
|
2018-01-22 18:25:48 +04:00
|
|
|
val lwt_fatal_error: ('a, Format.formatter, unit, unit Lwt.t) format4 -> 'a
|
2016-09-08 21:13:10 +04:00
|
|
|
|
|
|
|
end
|
|
|
|
|
2018-06-08 05:17:23 +04:00
|
|
|
module Core : sig
|
|
|
|
include SEMLOG
|
|
|
|
|
|
|
|
val worker : string Tag.def
|
|
|
|
end
|
2016-09-08 21:13:10 +04:00
|
|
|
|
|
|
|
module Make(S: sig val name: string end) : LOG
|
2018-06-27 04:06:09 +04:00
|
|
|
module Make_unregistered(S: sig val name: string end) : LOG
|
2016-09-08 21:13:10 +04:00
|
|
|
|
2018-06-08 05:17:23 +04:00
|
|
|
module Make_semantic(S: MESSAGE) : SEMLOG
|
|
|
|
|
2017-01-23 14:09:36 +04:00
|
|
|
type level = Lwt_log_core.level =
|
|
|
|
| Debug
|
2017-11-13 19:34:00 +04:00
|
|
|
(** Debugging message. They can be automatically removed by the
|
|
|
|
syntax extension. *)
|
2017-01-23 14:09:36 +04:00
|
|
|
| Info
|
2017-11-13 19:34:00 +04:00
|
|
|
(** Informational message. Suitable to be displayed when the
|
|
|
|
program is in verbose mode. *)
|
2017-01-23 14:09:36 +04:00
|
|
|
| Notice
|
2017-11-13 19:34:00 +04:00
|
|
|
(** Same as {!Info}, but is displayed by default. *)
|
2017-01-23 14:09:36 +04:00
|
|
|
| Warning
|
2017-11-13 19:34:00 +04:00
|
|
|
(** Something strange happend *)
|
2017-01-23 14:09:36 +04:00
|
|
|
| Error
|
2017-11-13 19:34:00 +04:00
|
|
|
(** An error message, which should not means the end of the
|
|
|
|
program. *)
|
2017-01-23 14:09:36 +04:00
|
|
|
| Fatal
|
|
|
|
|
|
|
|
type template = Lwt_log.template
|
|
|
|
val default_template : template
|
|
|
|
|
2018-02-08 13:51:01 +04:00
|
|
|
val sections: string list ref
|