diff --git a/infer/src/backend/InferAnalyze.ml b/infer/src/backend/InferAnalyze.ml index 12715706e..6b9e42cbb 100644 --- a/infer/src/backend/InferAnalyze.ml +++ b/infer/src/backend/InferAnalyze.ml @@ -32,7 +32,7 @@ let analyze_target : TaskScheduler.target Tasks.doer = let analyze_proc_name exe_env proc_name = decr procs_left ; if Int.( <= ) !procs_left 0 then ( - L.progress "Analysing block of %d procs, starting with %a@." + L.log_task "Analysing block of %d procs, starting with %a@." per_procedure_logging_granularity Typ.Procname.pp proc_name ; procs_left := per_procedure_logging_granularity ) ; Callbacks.analyze_proc_name exe_env proc_name diff --git a/infer/src/base/Logging.ml b/infer/src/base/Logging.ml index b15e5e011..7f07bd819 100644 --- a/infer/src/base/Logging.ml +++ b/infer/src/base/Logging.ml @@ -208,15 +208,15 @@ let phase fmt = log ~to_console:false phase_file_fmts fmt let progress fmt = log ~to_console:(not Config.quiet) progress_file_fmts fmt -let task_progress ~f pp x = +let log_task fmt = let to_console = match Config.progress_bar with `Plain -> true | `Quiet | `MultiLine -> false in - log ~to_console progress_file_fmts "%a starting@." pp x ; - f () ; - log ~to_console progress_file_fmts "%a DONE@." pp x + log ~to_console progress_file_fmts fmt +let task_progress ~f pp x = log_task "%a starting@." pp x ; f () ; log_task "%a DONE@." pp x + let user_warning fmt = log ~to_console:(not Config.quiet) user_warning_file_fmts fmt let user_error fmt = log ~to_console:true user_error_file_fmts fmt diff --git a/infer/src/base/Logging.mli b/infer/src/base/Logging.mli index 8de7d47c4..9750a66ef 100644 --- a/infer/src/base/Logging.mli +++ b/infer/src/base/Logging.mli @@ -23,6 +23,9 @@ val environment_info : ('a, F.formatter, unit) format -> 'a val progress : ('a, F.formatter, unit) format -> 'a (** print immediately to standard error unless --quiet is specified *) +val log_task : ('a, F.formatter, unit) format -> 'a +(** log progress in the log file and on the console unless there is an active task bar *) + val task_progress : f:(unit -> unit) -> (F.formatter -> 'a -> unit) -> 'a -> unit (** [task_progress ~f pp x] executes [f] and log progress [pp x] in the log file and also on the console unless there is an active task bar *)