sig
  type kind = Result | Feedback | Debug | Warning | Error | Failure
  type event = {
    evt_kind : Log.kind;
    evt_plugin : string;
    evt_category : string option;
    evt_source : Filepath.position option;
    evt_message : string;
  }
  type 'a pretty_printer =
      ?current:bool ->
      ?source:Filepath.position ->
      ?emitwith:(Log.event -> unit) ->
      ?echo:bool ->
      ?once:bool ->
      ?append:(Format.formatter -> unit) ->
      ('a, Format.formatter, unit) Pervasives.format -> 'a
  type ('a, 'b) pretty_aborter =
      ?current:bool ->
      ?source:Filepath.position ->
      ?echo:bool ->
      ?append:(Format.formatter -> unit) ->
      ('a, Format.formatter, unit, 'b) Pervasives.format4 -> 'a
  exception AbortError of string
  exception AbortFatal of string
  exception FeatureRequest of string * string
  type ontty = [ `Feedback | `Message | `Silent | `Transient ]
  type warn_status =
      Winactive
    | Wfeedback_once
    | Wfeedback
    | Wonce
    | Wactive
    | Werror_once
    | Werror
    | Wabort
  module type Messages =
    sig
      type category
      type warn_category
      val verbose_atleast : int -> bool
      val debug_atleast : int -> bool
      val printf :
        ?level:int ->
        ?dkey:Log.Messages.category ->
        ?current:bool ->
        ?source:Filepath.position ->
        ?append:(Format.formatter -> unit) ->
        ?header:(Format.formatter -> unit) ->
        ('a, Format.formatter, unit) Pervasives.format -> 'a
      val result :
        ?level:int -> ?dkey:Log.Messages.category -> 'Log.pretty_printer
      val feedback :
        ?ontty:Log.ontty ->
        ?level:int -> ?dkey:Log.Messages.category -> 'Log.pretty_printer
      val debug :
        ?level:int -> ?dkey:Log.Messages.category -> 'Log.pretty_printer
      val warning : ?wkey:Log.Messages.warn_category -> 'Log.pretty_printer
      val error : 'Log.pretty_printer
      val abort : ('a, 'b) Log.pretty_aborter
      val failure : 'Log.pretty_printer
      val fatal : ('a, 'b) Log.pretty_aborter
      val verify : bool -> ('a, bool) Log.pretty_aborter
      val not_yet_implemented :
        ('a, Format.formatter, unit, 'b) Pervasives.format4 -> 'a
      val deprecated : string -> now:string -> ('-> 'b) -> '-> 'b
      val with_result :
        (Log.event option -> 'b) -> ('a, 'b) Log.pretty_aborter
      val with_warning :
        (Log.event option -> 'b) -> ('a, 'b) Log.pretty_aborter
      val with_error :
        (Log.event option -> 'b) -> ('a, 'b) Log.pretty_aborter
      val with_failure :
        (Log.event option -> 'b) -> ('a, 'b) Log.pretty_aborter
      val log :
        ?kind:Log.kind -> ?verbose:int -> ?debug:int -> 'Log.pretty_printer
      val logwith :
        (Log.event option -> 'b) ->
        ?wkey:Log.Messages.warn_category ->
        ?emitwith:(Log.event -> unit) ->
        ?once:bool -> ('a, 'b) Log.pretty_aborter
      val register : Log.kind -> (Log.event -> unit) -> unit
      val register_tag_handlers :
        (string -> string) * (string -> string) -> unit
      val register_category : string -> Log.Messages.category
      val pp_category : Format.formatter -> Log.Messages.category -> unit
      val dkey_name : Log.Messages.category -> string
      val is_registered_category : string -> bool
      val get_category : string -> Log.Messages.category option
      val get_all_categories : unit -> Log.Messages.category list
      val add_debug_keys : Log.Messages.category -> unit
      val del_debug_keys : Log.Messages.category -> unit
      val get_debug_keys : unit -> Log.Messages.category list
      val is_debug_key_enabled : Log.Messages.category -> bool
      val get_debug_keyset : unit -> Log.Messages.category list
      val register_warn_category : string -> Log.Messages.warn_category
      val is_warn_category : string -> bool
      val pp_warn_category :
        Format.formatter -> Log.Messages.warn_category -> unit
      val pp_all_warn_categories_status : unit -> unit
      val wkey_name : Log.Messages.warn_category -> string
      val get_warn_category : string -> Log.Messages.warn_category option
      val get_all_warn_categories : unit -> Log.Messages.warn_category list
      val get_all_warn_categories_status :
        unit -> (Log.Messages.warn_category * Log.warn_status) list
      val set_warn_status :
        Log.Messages.warn_category -> Log.warn_status -> unit
      val get_warn_status : Log.Messages.warn_category -> Log.warn_status
    end
  val evt_category : Log.event -> string list
  val split_category : string -> string list
  val is_subcategory : string list -> string list -> bool
  module Register :
    functor
      (P : sig
             val channel : string
             val label : string
             val verbose_atleast : int -> bool
             val debug_atleast : int -> bool
           end->
      Messages
  val set_echo : ?plugin:string -> ?kind:Log.kind list -> bool -> unit
  val add_listener :
    ?plugin:string -> ?kind:Log.kind list -> (Log.event -> unit) -> unit
  val echo : Log.event -> unit
  val notify : Log.event -> unit
  type channel
  val new_channel : string -> Log.channel
  val log_channel : Log.channel -> ?kind:Log.kind -> 'Log.pretty_printer
  val kernel_channel_name : string
  val kernel_label_name : string
  val source : file:Filepath.Normalized.t -> line:int -> Filepath.position
  val get_current_source : unit -> Filepath.position
  val clean : unit -> unit
  val null : Format.formatter
  val nullprintf : ('a, Format.formatter, unit) Pervasives.format -> 'a
  val with_null :
    (unit -> 'b) -> ('a, Format.formatter, unit, 'b) Pervasives.format4 -> 'a
  val set_output :
    ?isatty:bool -> (string -> int -> int -> unit) -> (unit -> unit) -> unit
  val print_on_output : (Format.formatter -> unit) -> unit
  val print_delayed : (Format.formatter -> unit) -> unit
  val set_current_source : (unit -> Filepath.position) -> unit
  val check_not_yet : (Log.event -> bool) Pervasives.ref
  val tty : (unit -> bool) Pervasives.ref
  val cmdline_error_occurred : (exn -> unit) Pervasives.ref
  val cmdline_at_error_exit : ((exn -> unit) -> unit) Pervasives.ref
  val treat_deferred_error : unit -> unit
end