sig
  type kind = Result | Feedback | Debug | Warning | Error | Failure
  type event = {
    evt_kind : Log.kind;
    evt_plugin : string;
    evt_dkey : string option;
    evt_source : Lexing.position option;
    evt_message : string;
  }
  type 'a pretty_printer =
      ?current:bool ->
      ?source:Lexing.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:Lexing.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 category = private string
  type ontty = [ `Feedback | `Message | `Silent | `Transient ]
  module Category_set :
    sig
      type elt = category
      type t
      val empty : t
      val is_empty : t -> bool
      val mem : elt -> t -> bool
      val add : elt -> t -> t
      val singleton : elt -> t
      val remove : elt -> t -> t
      val union : t -> t -> t
      val inter : t -> t -> t
      val diff : t -> t -> t
      val compare : t -> t -> int
      val equal : t -> t -> bool
      val subset : t -> t -> bool
      val iter : (elt -> unit) -> t -> unit
      val fold : (elt -> '-> 'a) -> t -> '-> 'a
      val for_all : (elt -> bool) -> t -> bool
      val exists : (elt -> bool) -> t -> bool
      val filter : (elt -> bool) -> t -> t
      val partition : (elt -> bool) -> t -> t * t
      val cardinal : t -> int
      val elements : t -> elt list
      val choose : t -> elt
      val split : elt -> t -> t * bool * t
      val find : elt -> t -> elt
      val of_list : elt list -> t
      val min_elt : t -> elt
      val max_elt : t -> elt
      val nearest_elt_le : elt -> t -> elt
      val nearest_elt_ge : elt -> t -> elt
    end
  module type Messages =
    sig
      val verbose_atleast : int -> bool
      val debug_atleast : int -> bool
      val printf :
        ?level:int ->
        ?dkey:Log.category ->
        ?current:bool ->
        ?source:Lexing.position ->
        ?append:(Format.formatter -> unit) ->
        ?header:(Format.formatter -> unit) ->
        ?prefix:string ->
        ?suffix:string ->
        ('a, Format.formatter, unit) Pervasives.format -> 'a
      val result : ?level:int -> ?dkey:Log.category -> 'Log.pretty_printer
      val feedback :
        ?ontty:Log.ontty ->
        ?level:int -> ?dkey:Log.category -> 'Log.pretty_printer
      val debug : ?level:int -> ?dkey:Log.category -> 'Log.pretty_printer
      val warning : '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 -> 'b) -> ('a, 'b) Log.pretty_aborter
      val with_warning : (Log.event -> 'b) -> ('a, 'b) Log.pretty_aborter
      val with_error : (Log.event -> 'b) -> ('a, 'b) Log.pretty_aborter
      val with_failure : (Log.event -> 'b) -> ('a, 'b) Log.pretty_aborter
      val log :
        ?kind:Log.kind -> ?verbose:int -> ?debug:int -> 'Log.pretty_printer
      val with_log :
        (Log.event -> 'b) -> ?kind:Log.kind -> ('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.category
      val get_category : string -> Log.Category_set.t
      val get_all_categories : unit -> Log.Category_set.t
      val add_debug_keys : Log.Category_set.t -> unit
      val del_debug_keys : Log.Category_set.t -> unit
      val get_debug_keys : unit -> Log.Category_set.t
      val is_debug_key_enabled : Log.category -> bool
      val get_debug_keyset : unit -> Log.category list
    end
  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
  type prefix = Label of string | Prefix of string | Indent of int
  val log_channel :
    Log.channel ->
    ?kind:Log.kind -> ?prefix:Log.prefix -> 'Log.pretty_printer
  val with_log_channel :
    Log.channel ->
    (Log.event -> 'b) ->
    ?kind:Log.kind -> ?prefix:Log.prefix -> ('a, 'b) Log.pretty_aborter
  val kernel_channel_name : string
  val kernel_label_name : string
  val get_current_source : unit -> Lexing.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 -> Lexing.position) -> unit
  val check_not_yet : (Log.event -> bool) Pervasives.ref
  val tty : (unit -> bool) Pervasives.ref
end