From 5155417800a23ba804e3bb9e4534e330cb978145 Mon Sep 17 00:00:00 2001 From: Jules Villard Date: Thu, 29 Mar 2018 07:52:42 -0700 Subject: [PATCH] [debug] add `Logging.debug_dev` for temporary debugging Summary: Utility function that's basically `Logging.progress` but with a more obvious name for debugging. The `[@deprecated ...]` ensures no uses gets landed, and the `[@warning "-32"]` ensures that it's not a compile error that there are no uses of this function. Inspired by #716. Reviewed By: mbouaziz Differential Revision: D7443224 fbshipit-source-id: e94798f --- infer/src/base/Logging.ml | 4 ++++ infer/src/base/Logging.mli | 7 +++++++ 2 files changed, 11 insertions(+) diff --git a/infer/src/base/Logging.ml b/infer/src/base/Logging.ml index 1f70b48d5..27997aae7 100644 --- a/infer/src/base/Logging.ml +++ b/infer/src/base/Logging.ml @@ -163,6 +163,8 @@ let log ~to_console ?(to_file= true) (lazy formatters) = let debug_file_fmts = register_formatter "debug" +let debug_dev_file_fmts = register_formatter "local debug" + let environment_info_file_fmts = register_formatter "environment" let external_warning_file_fmts = register_formatter "extern warn" @@ -218,6 +220,8 @@ let debug_level_of_int n = if n <= 0 then Quiet else if Int.equal n 1 then Medium else (* >= 2 *) Verbose +let debug_dev fmt = log ~to_console:true debug_dev_file_fmts fmt + let analysis_debug_level = debug_level_of_int Config.debug_level_analysis let bufferoverrun_debug_level = debug_level_of_int Config.bo_debug diff --git a/infer/src/base/Logging.mli b/infer/src/base/Logging.mli index ffbbb660c..9cb7de883 100644 --- a/infer/src/base/Logging.mli +++ b/infer/src/base/Logging.mli @@ -63,6 +63,13 @@ type debug_level = val debug : debug_kind -> debug_level -> ('a, F.formatter, unit) format -> 'a (** log debug info *) +val debug_dev : ('a, Format.formatter, unit) format -> 'a + [@@deprecated + "Only use to debug during development. If you want more permanent logging, use \ + [Logging.debug] instead."] +[@@warning "-32"] +(** For debugging during development. *) + (** Type of location in ml source: __POS__ *) type ocaml_pos = string * int * int * int