[logging] replicate internal errors in scuba

Summary: Log all internal errors to scuba as well.

Reviewed By: jvillard

Differential Revision: D21017432

fbshipit-source-id: 42ef2e910
master
Nikos Gorogiannis 5 years ago committed by Facebook GitHub Bot
parent 47c0f9742a
commit 93fe38bbc3

@ -265,6 +265,16 @@ let debug kind level fmt =
log ~to_console:false ~to_file debug_file_fmts fmt log ~to_console:false ~to_file debug_file_fmts fmt
(** log to scuba as well as in the original logger *)
let wrap_in_scuba_log ~label ~log fmt =
let wrapper message =
ScubaLogging.log_message ~label ~message ;
(* [format_of_string] is there to satisfy the type checker *)
log (format_of_string "%s") message
in
F.kasprintf wrapper fmt
let result fmt = log ~to_console:true result_file_fmts fmt let result fmt = log ~to_console:true result_file_fmts fmt
let environment_info fmt = log ~to_console:false environment_info_file_fmts fmt let environment_info fmt = log ~to_console:false environment_info_file_fmts fmt
@ -275,6 +285,9 @@ let external_error fmt = log ~to_console:true external_error_file_fmts fmt
let internal_error fmt = log ~to_console:true internal_error_file_fmts fmt let internal_error fmt = log ~to_console:true internal_error_file_fmts fmt
(* mask original function and replicate log in scuba *)
let internal_error fmt = wrap_in_scuba_log ~label:"internal_error" ~log:internal_error fmt
(** Type of location in ml source: __POS__ *) (** Type of location in ml source: __POS__ *)
type ocaml_pos = string * int * int * int type ocaml_pos = string * int * int * int

@ -19,7 +19,6 @@ val log_count : label:string -> value:int -> unit
(** Log anything that can be counted. Events will be prefixed with ["count."] *) (** Log anything that can be counted. Events will be prefixed with ["count."] *)
val log_message : label:string -> message:string -> unit val log_message : label:string -> message:string -> unit
[@@warning "-32"]
(** Log a [string]. Event is prefixed with ["msg."] *) (** Log a [string]. Event is prefixed with ["msg."] *)
val execute_with_time_logging : string -> (unit -> 'a) -> 'a val execute_with_time_logging : string -> (unit -> 'a) -> 'a

Loading…
Cancel
Save