This file is indexed.

/usr/lib/ocaml/batteries/batLog.mli is in libbatteries-ocaml-dev 2.4-1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
(*
 * BatLog - Simple Logging module
 * Copyright (C) 2011 The Batteries Included Team
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version,
 * with the special exception on linking described in file LICENSE.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 *)

(** Simple logging
    @author Edgar Friendly
*)
open BatIO

(** This ref holds the output channel for simple logging.  Defaults to
    [stderr]

    @since 2.0; had getter and setter in 1.x
*)
val output : unit output ref

(** This ref holds the text printed before each log message.  Defaults to
    the empty string.

    @since 2.0; had getter and setter in 1.x
*)
val prefix : string ref

type flag = [
  | `Date (** Print the current date as 2011-06-28 *)
  | `Time (** Print the current time as 01:23:45 *)
  | `Filepos (** Print the file and linenum of this log command (UNIMPLEMENTED - needs syntax extension) *)
  | `Custom of unit -> string (** Print the results of running the given closure *)
]

(** This ref holds the output flags.  These flags control how the log
    messages are output.  The default is [`Date; `Time] and log
    messages are printed as:

    2011/0628 01:23:45: prefixmessage

    @since 2.0; had getter and setter in 1.x
*)
val flags : flag list ref

(** [log s] logs the message s, returning unit.

    @since 2.0; was [print] in 1.x
*)
val log : ?fp:string -> string -> unit


(** As [Printf.printf], only the message is printed to the logging
    output and prefixed with status information per the current flags and
    the currently set prefix.

    @since 2.0; was [printf] in 1.x
*)
val logf: ?fp:string -> ('a, unit output, unit) Pervasives.format -> 'a

(** [fatal s] logs the message [s] and then calls [exit 1].  This
    exits the program with return code 1.  *)
val fatal : ?fp:string -> string -> 'a

(** [fatalf] allows a format string (as [Printf.printf])and the
    arguments to that format string to build the logging message.
    Exits the program with return code 1. *)
val fatalf: ?fp:string -> ('a, unit output, unit) Pervasives.format -> 'a

module type Config = sig
  type t
  val out: t output
  val prefix: string
  val flags: flag list
end

(** Build a logger module with custom, fixed output, prefix and flags *)
module Make (S:Config) : sig
  (** [print s] logs the message s, returning unit. *)
  val log : ?fp:string -> string -> unit

  (** As [Printf.printf], only the message is printed to the logging
      output and prefixed with status information per the current flags and
      the currently set prefix. *)
  val logf: ?fp:string -> ('a, S.t output, unit) Pervasives.format -> 'a

  (** [fatal s] logs the message [s] and then calls [exit 1].  This
      exits the program with return code 1.  *)
  val fatal : ?fp:string -> string -> 'a

  (** [fatalf] allows a format string (as [Printf.printf])and the
      arguments to that format string to build the logging message.
      Exits the program with return code 1. *)
  val fatalf: ?fp:string -> ('a, S.t output, unit) Pervasives.format -> 'a

end

(** Returns an object with methods [fatal], [fatalf], [log], and
    [logf] that logs to the given output channel, with given prefix
    and flags.  These methods work like the corresponding functions in
    the BatLog module.

    @since 2.0
*)

val make_logger :
  'a output ->
  string ->
  [< `Custom of unit -> string | `Date | `Filepos | `Time ] list ->
  < fatal : ?fp:string -> string -> 'b;
    fatalf : ?fp:string ->
      ('c, 'a output, unit, unit, unit, 'd) format6 -> 'c;
    log : ?fp:string -> string -> unit;
    logf : ?fp:string -> ('e, 'a output, unit) format -> 'e >

        (** The different verbosity levels supported in the [Easy] logger *)
type easy_lev = [ `trace | `debug | `info | `warn | `error | `fatal | `always ]

(** A simple-to-use logger with verbosity levels that outputs by
    default to stderr (changeable at runtime) with the date and time
    at the beginning of each log message.

    @since 2.0
*)
module Easy : sig
  (** Set this ref to the lowest level of log you want logged.  For
      example, [Easy.level := `always] disables all logging except
      that at the [`always] level.  Setting [Easy.level := `info] will
      enable logging for [`info], [`warn], [`error], [`fatal] and
      [`always] levels. *)
  val level : easy_lev ref
  (** Set this ref to the output you want logging messages to go
      to.  Defaults to [stderr]. *)
  val output : unit output ref

  (** [log lev msg] logs the message [msg] if the current logging
      level is [lev] or lower.  *)
  val log : ?fp:string -> easy_lev -> string -> unit

  (** As [log], but instead of a string message, a printf format is
      allowed with whatever arguments are appropriate. *)
  val logf : ?fp:string -> easy_lev -> ('a, unit output, unit) format -> 'a
end


(** The details of a level scheme for verbosity-level loggers *)
module type Level_sig = sig
  (** A type for level values, usually a polymorphic variant *)
  type t
  (** Convert each level to a string *)
  val to_string : t -> string
  (** The default level for loggers created with this; log messages
      with level less than this won't be printed by default. *)
  val default_level : t
  (** a comparison function between levels, to know whether logging at a
      particular level should be printed *)
  val compare : t -> t -> int
end

(** Make your own level-based logger, like [Easy] *)
module Make_lev(L:Level_sig)(S:Config) : sig
  val level : L.t ref
  val output : S.t output ref
  val log : ?fp:string -> L.t -> string -> unit
  val logf : ?fp:string -> L.t -> ('a, S.t output, unit) format -> 'a
end