enhanced PROCESS_FILE
[hiphop-php.git] / hphp / hack / src / utils / core / hh_logger.mli
blob5aaabb4724476dc470f29260c89a2c1982cff91b
1 (*
2 * Copyright (c) 2019, Facebook, Inc.
3 * All rights reserved.
5 * This source code is licensed under the MIT license found in the
6 * LICENSE file in the "hack" directory of this source tree.
8 *)
10 (** enables logging to a file (in addition to stderr which is always enabled) *)
11 val set_log : string -> unit
13 val set_id : string -> unit
15 val get_id : unit -> string option
17 val print_with_newline :
18 ?exn:Exception.t -> ('a, unit, string, unit) format4 -> 'a
20 val print_duration : string -> float -> float
22 val exc : ?prefix:string -> stack:string -> exn -> unit
24 val exception_ : ?prefix:string -> Exception.t -> unit
26 module Level : sig
27 type t =
28 | Off
29 | Fatal
30 | Error
31 | Warn
32 | Info
33 | Debug
34 [@@deriving enum]
36 val of_enum_string : string -> t option
38 val to_enum_string : t -> string
40 (** returns the min file log level *)
41 val min_level_file : unit -> t
43 (** returns the min stderr log level *)
44 val min_level_stderr : unit -> t
46 (** overwrites min level for both stderr and file (if enabled) *)
47 val set_min_level : t -> unit
49 (** overwrites min level for file (if enabled), but leaves stderr as is *)
50 val set_min_level_file : t -> unit
52 (** overwrites min level for stderr, but leaves file (if enabled) as is *)
53 val set_min_level_stderr : t -> unit
55 (** overwrites the set of categories that be checked for log level before
56 being output; when logs are logged with no category, then only the log
57 level is used to decide whether the log entry should be output;
58 if a category is specified when logging, then this list of categories
59 will be checked in addition to the log level *)
60 val set_categories : string list -> unit
62 (** returns true if t passes either stderr or file min level (regardless whether file is enabled) *)
63 val passes_min_level : t -> bool
65 (** logs the message and how long the presumed operation took, assuming that
66 the float argument is the start time and that the end time is now *)
67 val log_duration : t -> ?category:string -> string -> float -> float
68 end
70 val log :
71 ?lvl:Level.t ->
72 ?category:string ->
73 ('a, unit, string, string, string, unit) format6 ->
76 val log_lazy : ?lvl:Level.t -> ?category:string -> string lazy_t -> unit
78 val log_duration : ?lvl:Level.t -> ?category:string -> string -> float -> float
80 val fatal :
81 ?category:string ->
82 ?exn:Exception.t ->
83 ('a, unit, string, string, string, unit) format6 ->
86 val error :
87 ?category:string ->
88 ?exn:Exception.t ->
89 ('a, unit, string, string, string, unit) format6 ->
92 val warn :
93 ?category:string ->
94 ?exn:Exception.t ->
95 ('a, unit, string, string, string, unit) format6 ->
98 val info :
99 ?category:string ->
100 ?exn:Exception.t ->
101 ('a, unit, string, string, string, unit) format6 ->
104 val debug :
105 ?category:string ->
106 ?exn:Exception.t ->
107 ('a, unit, string, string, string, unit) format6 ->