Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace direct stdout printing with logging #1117

Merged
merged 43 commits into from
Feb 13, 2024
Merged
Show file tree
Hide file tree
Changes from 15 commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
b1e3770
Add Logs prototype
sim642 Mar 14, 2023
f7d2d5b
Add semgrep rule for printing
sim642 Mar 14, 2023
80125a7
Start using Logs
sim642 Mar 14, 2023
aff84b1
Add newline after logging
sim642 Mar 14, 2023
72bf02f
Use more Logs
sim642 Mar 14, 2023
aa1e112
Add Logs.newline
sim642 Mar 14, 2023
1aa91c1
Use Logs everywhere
sim642 Mar 14, 2023
22d8963
Remove %! from Logs formats
sim642 Mar 14, 2023
2d8678f
Remove newlines from log messages
sim642 Mar 14, 2023
3dcf492
Implement Logs.newline
sim642 Mar 14, 2023
9c4d1b8
Extract GobPretty.igprintf from Tracing
sim642 Mar 14, 2023
67441e0
Add logging levels
sim642 Mar 14, 2023
5cd82af
Use Logs where semgrep missed
sim642 Mar 14, 2023
61646c5
Add colors to Logs
sim642 Mar 14, 2023
a229a40
Merge branch 'master' into logs
sim642 Jul 26, 2023
0697234
Use Logs.info in longjmp autotune
sim642 Jul 26, 2023
23a14b0
Remove unused Printf opens
sim642 Jul 26, 2023
d2377cd
Fix d_varinfo mismerge
sim642 Jul 26, 2023
b836978
Add dbg.level option
sim642 Aug 1, 2023
16344cc
Remove Maingoblint.eprint_color
sim642 Aug 1, 2023
e673d9d
Add log message level printing
sim642 Aug 1, 2023
ec1eeb5
Fix log output in cram tests
sim642 Aug 1, 2023
ea809cf
Revert --version to normal stdout printing
sim642 Aug 1, 2023
d3283ea
Use Logs.debug instead of dbg.verbose conditional in most places
sim642 Aug 1, 2023
4c463c7
Remove dbg.verbose option
sim642 Aug 1, 2023
bb7d504
Fix dbg.verbose in gobview
sim642 Aug 1, 2023
bf4cb31
Document logging
sim642 Aug 1, 2023
eb8b14d
Merge branch 'master' into logs
sim642 Jan 10, 2024
a354ce3
Replace merged direct printing with Logs
sim642 Jan 10, 2024
bbc360f
Add Result log level to stdout
sim642 Jan 10, 2024
68d1d1a
Use Logs.result
sim642 Jan 10, 2024
31ad591
Optimize ValueDomain.warn_type
sim642 Jan 10, 2024
0ca32e0
Use messages for dbg.print_tids
sim642 Jan 10, 2024
6f89b91
Update cram test with SV-COMP specification
sim642 Jan 11, 2024
355c521
Update log levels in debugging docs
sim642 Jan 11, 2024
c9834e8
Add warning about dbg.print_wpoints
sim642 Jan 11, 2024
32db3a3
Add result log level to options
sim642 Jan 11, 2024
9135222
Remove print_endline for GobView
sim642 Jan 11, 2024
05d9cce
Do not use stdout for logs if server.mode is stdio
sim642 Jan 11, 2024
b8b98f3
Add warning about dbg.print_tids
sim642 Feb 7, 2024
520c742
Replace WTF error in Goblint_tracing
sim642 Feb 7, 2024
f3b1945
Merge branch 'master' into logs
sim642 Feb 7, 2024
b61a064
Merge branch 'master' into logs
sim642 Feb 13, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 38 additions & 0 deletions .semgrep/logs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
rules:
- id: print-not-logging
pattern-either:
- pattern: printf
- pattern: Printf.printf
- pattern: BatPrintf.printf
- pattern: Format.printf
- pattern: Pretty.printf

- pattern: eprintf
- pattern: Printf.eprintf
- pattern: BatPrintf.eprintf
- pattern: Format.eprintf
- pattern: Pretty.eprintf

- pattern: print_endline
- pattern: prerr_endline
- pattern: print_string
paths:
exclude:
- logs.ml
- bench/
message: printing should be replaced with logging
languages: [ocaml]
severity: WARNING

- id: print-newline-not-logging
pattern-either:
- pattern: print_newline
- pattern: prerr_newline
paths:
exclude:
- logs.ml
- bench/
fix: Logs.newline
message: use Logs instead
languages: [ocaml]
severity: WARNING
2 changes: 1 addition & 1 deletion src/analyses/apron/relationAnalysis.apron.ml
Original file line number Diff line number Diff line change
Expand Up @@ -727,7 +727,7 @@ struct
let finalize () =
let file = GobConfig.get_string "exp.relation.prec-dump" in
if file <> "" then begin
Printf.printf "exp.relation.prec-dump is potentially costly (for domains other than octagons), do not use for performance data!\n";
Logs.warn "exp.relation.prec-dump is potentially costly (for domains other than octagons), do not use for performance data!";
Timing.wrap "relation.prec-dump" store_data (Fpath.v file)
end;
Priv.finalize ()
Expand Down
8 changes: 4 additions & 4 deletions src/analyses/basePriv.ml
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ struct
CPA.find x st.cpa
(* let read_global ask getg cpa x =
let (cpa', v) as r = read_global ask getg cpa x in
ignore (Pretty.printf "READ GLOBAL %a (%a, %B) = %a\n" CilType.Varinfo.pretty x CilType.Location.pretty !Tracing.current_loc (is_unprotected ask x) VD.pretty v);
Logs.debug "READ GLOBAL %a (%a, %B) = %a" d_varinfo x CilType.Location.pretty !Tracing.current_loc (is_unprotected ask x) VD.pretty v;
r *)
let write_global ?(invariant=false) ask getg sideg (st: BaseComponents (D).t) x v =
let cpa' = CPA.add x v st.cpa in
Expand All @@ -240,7 +240,7 @@ struct
{st with cpa = cpa'}
(* let write_global ask getg sideg cpa x v =
let cpa' = write_global ask getg sideg cpa x v in
ignore (Pretty.printf "WRITE GLOBAL %a %a = %a\n" CilType.Varinfo.pretty x VD.pretty v CPA.pretty cpa');
Logs.debug "WRITE GLOBAL %a %a = %a" d_varinfo x VD.pretty v CPA.pretty cpa';
cpa' *)

let lock ask getg (st: BaseComponents (D).t) m =
Expand Down Expand Up @@ -335,7 +335,7 @@ struct
{st with cpa = cpa'}
(* let write_global ask getg sideg cpa x v =
let cpa' = write_global ask getg sideg cpa x v in
ignore (Pretty.printf "WRITE GLOBAL %a %a = %a\n" CilType.Varinfo.pretty x VD.pretty v CPA.pretty cpa');
Logs.debug "WRITE GLOBAL %a %a = %a" d_varinfo x VD.pretty v CPA.pretty cpa';
cpa' *)

let lock (ask: Queries.ask) getg (st: BaseComponents (D).t) m =
Expand Down Expand Up @@ -1674,7 +1674,7 @@ struct
let dump () =
let f = open_out_bin (get_string "exp.priv-prec-dump") in
(* LVH.iter (fun (l, x) v ->
ignore (Pretty.printf "%a %a = %a\n" CilType.Location.pretty l CilType.Varinfo.pretty x VD.pretty v)
Logs.debug "%a %a = %a" CilType.Location.pretty l CilType.Varinfo.pretty x VD.pretty v
) lvh; *)
Marshal.output f ({name = get_string "ana.base.privatization"; results = lvh}: result);
close_out_noerr f
Expand Down
6 changes: 3 additions & 3 deletions src/analyses/extractPthread.ml
Original file line number Diff line number Diff line change
Expand Up @@ -576,7 +576,7 @@ module Codegen = struct
let dir = GobSys.mkdir_or_exists_absolute (Fpath.v "pml-result") in
let path = Fpath.to_string @@ Fpath.append dir (Fpath.v ("pthread." ^ ext)) in
output_file ~filename:path ~text:content ;
print_endline @@ "saved " ^ desc ^ " as " ^ path
Logs.info "saved %s as %s" desc path
michael-schwarz marked this conversation as resolved.
Show resolved Hide resolved
end

let tabulate = ( ^ ) "\t"
Expand Down Expand Up @@ -612,7 +612,7 @@ module Codegen = struct
let called_funs_done = ref Set.empty in

let rec process_def res =
print_endline @@ Resource.show res ;
print_endline @@ Resource.show res ; (* nosemgrep: print-not-logging *)
Fixed Show fixed Hide fixed
Dismissed Show dismissed Hide dismissed
let res_type = Resource.res_type res in
let res_name = Resource.res_name res in
let is_thread = res_type = Resource.Thread in
Expand Down Expand Up @@ -850,7 +850,7 @@ module Codegen = struct

Writer.write "promela model" "pml" promela ;
Writer.write "graph" "dot" dot_graph ;
print_endline
Logs.info
sim642 marked this conversation as resolved.
Show resolved Hide resolved
"Copy spin/pthread_base.pml to same folder and then do: spin -a \
pthread.pml && cc -o pan pan.c && ./pan -a"
end
Expand Down
2 changes: 1 addition & 1 deletion src/analyses/mCP.ml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ struct
let y = find_id yn in
if not (exists (fun (y',_) -> y=y') xs) then begin
let xn = find_spec_name x in
Legacy.Printf.eprintf "Activated analysis '%s' depends on '%s' and '%s' is not activated.\n" xn yn yn;
Logs.error "Activated analysis '%s' depends on '%s' and '%s' is not activated.\n" xn yn yn;
raise Stdlib.Exit
end
in
Expand Down
2 changes: 1 addition & 1 deletion src/analyses/raceAnalysis.ml
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ struct
let g: V.t = Obj.obj g in
begin match g with
| `Left g' -> (* accesses *)
(* ignore (Pretty.printf "WarnGlobal %a\n" CilType.Varinfo.pretty g); *)
(* Logs.debug "WarnGlobal %a" CilType.Varinfo.pretty g; *)
let trie = G.access (ctx.global g) in
(** Distribute access to contained fields. *)
let rec distribute_inner offset (accs, children) ancestor_accs =
Expand Down
2 changes: 1 addition & 1 deletion src/analyses/termination.ml
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ class loopInstrVisitor (fd : fundec) = object(self)
| _ -> ());
s
| Loop (b, loc, eloc, Some continue, Some break) ->
print_endline @@ "WARN: Could not determine loop variable for loop at " ^ CilType.Location.show loc;
Logs.warn "WARN: Could not determine loop variable for loop at %a" CilType.Location.pretty loc;
s
| _ when Hashtbl.mem loopBreaks s.sid -> (* after a loop, we check that t is bounded/positive (no overflow happened) *)
let loc = Hashtbl.find loopBreaks s.sid in
Expand Down
13 changes: 7 additions & 6 deletions src/analyses/threadId.ml
Original file line number Diff line number Diff line change
Expand Up @@ -156,12 +156,13 @@ struct
let non_uniques = List.filter_map (fun (a,b) -> if not (Thread.is_unique a) then Some a else None) tids in
let uc = List.length uniques in
let nc = List.length non_uniques in
Printf.printf "Encountered number of thread IDs (unique): %i (%i)\n" (uc+nc) uc;
Printf.printf "unique: ";
List.iter (fun tid -> Printf.printf " %s " (Thread.show tid)) uniques;
Printf.printf "\nnon-unique: ";
List.iter (fun tid -> Printf.printf " %s " (Thread.show tid)) non_uniques;
Printf.printf "\n"
Logs.debug "Encountered number of thread IDs (unique): %i (%i)" (uc+nc) uc;
sim642 marked this conversation as resolved.
Show resolved Hide resolved
Logs.debug "unique: ";
List.iter (fun tid -> Logs.debug " %s " (Thread.show tid)) uniques;
Logs.newline ();
Logs.debug "non-unique: ";
List.iter (fun tid -> Logs.debug " %s " (Thread.show tid)) non_uniques;
Logs.newline ()

let finalize () =
if GobConfig.get_bool "dbg.print_tids" then print_tid_info ();
Expand Down
42 changes: 21 additions & 21 deletions src/autoTune.ml
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ let findMallocWrappers () =
|> FunctionCallMap.filter (fun f _ -> timesCalled f > 10)
|> FunctionCallMap.bindings
|> List.map (fun (v,_) -> v.vname)
|> List.iter (fun n -> print_endline ("malloc wrapper: " ^ n); GobConfig.set_auto "ana.malloc.wrappers[+]" n)
|> List.iter (fun n -> Logs.info "malloc wrapper: %s" n; GobConfig.set_auto "ana.malloc.wrappers[+]" n)


(*Functions for determining if the congruence analysis should be enabled *)
Expand All @@ -98,7 +98,7 @@ let rec setCongruenceRecursive fd depth neigbourFunction =
fd.svar.vattr <- addAttributes (fd.svar.vattr) [Attr ("goblint_precision",[AStr "congruence"])];
FunctionSet.iter
(fun vinfo ->
print_endline (" " ^ vinfo.vname);
Logs.info " %s" vinfo.vname;
setCongruenceRecursive (Cilfacade.find_varinfo_fundec vinfo) (depth -1) neigbourFunction
)
(FunctionSet.filter (*for extern and builtin functions there is no function definition in CIL*)
Expand All @@ -125,10 +125,10 @@ class modFunctionAnnotatorVisitor = object
let thisVisitor = new modVisitor in
try ignore (visitCilFunction thisVisitor fd) with
| ModFound ->
print_endline ("function " ^ (CilType.Fundec.show fd) ^" uses mod, enable congruence domain recursively for:");
print_endline (" \"down\":");
Logs.info "function %a uses mod, enable congruence domain recursively for:" CilType.Fundec.pretty fd;
Logs.info " \"down\":";
setCongruenceRecursive fd 6 calledFunctions;
print_endline (" \"up\":");
Logs.info " \"up\":";
setCongruenceRecursive fd 3 callingFunctions;
;
SkipChildren
Expand All @@ -144,7 +144,7 @@ let disableIntervalContextsInRecursiveFunctions () =
(ResettableLazy.force functionCallMaps).calling |> FunctionCallMap.iter (fun f set ->
(*detect direct recursion and recursion with one indirection*)
if FunctionSet.mem f set || (not @@ FunctionSet.disjoint (calledFunctions f) (callingFunctions f)) then (
print_endline ("function " ^ (f.vname) ^" is recursive, disable interval and interval_set contexts");
Logs.info "function %s is recursive, disable interval and interval_set contexts" f.vname;
f.vattr <- addAttributes (f.vattr) [Attr ("goblint_context",[AStr "base.no-interval"; AStr "base.no-interval_set"; AStr "relation.no-context"])];
)
)
Expand Down Expand Up @@ -192,7 +192,7 @@ let reduceThreadAnalyses () =
in
let hasThreadCreate = hasFunction isThreadCreate in
if not @@ hasThreadCreate then (
print_endline @@ "no thread creation -> disabling thread analyses \"" ^ (String.concat ", " notNeccessaryThreadAnalyses) ^ "\"";
Logs.info "no thread creation -> disabling thread analyses \"%s\"" (String.concat ", " notNeccessaryThreadAnalyses);
disableAnalyses notNeccessaryThreadAnalyses;
)

Expand All @@ -214,7 +214,7 @@ let focusOnSpecification () =
match Svcomp.Specification.of_option () with
| UnreachCall s -> ()
| NoDataRace -> (*enable all thread analyses*)
print_endline @@ "Specification: NoDataRace -> enabling thread analyses \"" ^ (String.concat ", " notNeccessaryThreadAnalyses) ^ "\"";
Logs.info "Specification: NoDataRace -> enabling thread analyses \"%s\"" (String.concat ", " notNeccessaryThreadAnalyses);
enableAnalyses notNeccessaryThreadAnalyses;
| NoOverflow -> (*We focus on integer analysis*)
set_bool "ana.int.def_exc" true;
Expand Down Expand Up @@ -363,9 +363,9 @@ let congruenceOption factors file =
let cost = (locals + globals) * (factors.instructions / 12) + 5 * factors.functionCalls in
let value = 5 * locals + globals in
let activate () =
print_endline @@ "Congruence: " ^ string_of_int cost;
Logs.debug "Congruence: %d" cost;
set_bool "ana.int.congruence" true;
print_endline "Enabled congruence domain.";
Logs.info "Enabled congruence domain.";
in
{
value;
Expand Down Expand Up @@ -396,14 +396,14 @@ let apronOctagonOption factors file =
let allVars = (selectedGlobals @ selectedLocals) in
let cost = (Batteries.Int.pow (locals + globals) 3) * (factors.instructions / 70) in
let activateVars () =
print_endline @@ "Octagon: " ^ string_of_int cost;
Logs.debug "Octagon: %d" cost;
set_bool "annotation.goblint_relation_track" true;
set_string "ana.apron.domain" "octagon";
set_auto "ana.activated[+]" "apron";
set_bool "ana.apron.threshold_widening" true;
set_string "ana.apron.threshold_widening_constants" "comparisons";
print_endline "Enabled octagon domain for:";
print_endline @@ String.concat ", " @@ List.map (fun info -> info.vname) allVars;
Logs.info "Enabled octagon domain for:";
Logs.info "%s" @@ String.concat ", " @@ List.map (fun info -> info.vname) allVars;
List.iter (fun info -> info.vattr <- addAttribute (Attr("goblint_relation_track",[])) info.vattr) allVars
in
{
Expand All @@ -420,10 +420,10 @@ let wideningOption factors file =
value = amountConsts * (factors.loops * 5 + factors.controlFlowStatements);
cost = cost;
activate = fun () ->
print_endline @@ "Widening: " ^ string_of_int cost;
Logs.debug "Widening: %d" cost;
set_bool "ana.int.interval_threshold_widening" true;
set_string "ana.int.interval_threshold_widening_constants" "comparisons";
print_endline "Enabled widening thresholds";
Logs.info "Enabled widening thresholds";
}


Expand All @@ -443,13 +443,13 @@ let chooseFromOptions costTarget options =
let ratio o = Float.of_int o.value /. Float.of_int o.cost in
let compareRatio o1 o2 = Float.compare (ratio o1) (ratio o2) in
let rec takeFitting remainingTarget options =
if remainingTarget < 0 then (print_endline @@ "Total: " ^ string_of_int (totalTarget - remainingTarget); [] ) else match options with
if remainingTarget < 0 then (Logs.debug "Total: %d" (totalTarget - remainingTarget); [] ) else match options with
| o::os ->
if o.cost < remainingTarget + costTarget / 20 then (*because we are already estimating, we allow overshooting *)
o::takeFitting (remainingTarget - o.cost) os
else
takeFitting (remainingTarget - o.cost) os
| [] -> print_endline @@ "Total: " ^ string_of_int (totalTarget - remainingTarget); []
| [] -> Logs.debug "Total: %d" (totalTarget - remainingTarget); []
in
takeFitting costTarget @@ List.sort compareRatio options

Expand All @@ -459,11 +459,11 @@ let chooseConfig file =
let factors = collectFactors visitCilFileSameGlobals file in
let fileCompplexity = estimateComplexity factors file in

print_endline "Collected factors:";
Logs.debug "Collected factors:";
printFactors factors;
print_endline "";
print_endline "Complexity estimates:";
print_endline @@ "File: " ^ string_of_int fileCompplexity;
Logs.debug "";
Logs.debug "Complexity estimates:";
Logs.debug "File: %d" fileCompplexity;

if fileCompplexity < totalTarget && isActivated "congruence" then
addModAttributes file;
Expand Down
21 changes: 10 additions & 11 deletions src/autoTune0.ml
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,16 @@ type complexityFactors = {
}

let printFactors f =
Printf.printf "functions: %d\n" f.functions;
Printf.printf "functionCalls: %d\n" f.functionCalls;
Printf.printf "loops: %d\n" f.loops;
Printf.printf "loopBreaks: %d\n" f.loopBreaks;
Printf.printf "controlFlowStatements: %d\n" f.controlFlowStatements;
Printf.printf "expressions: %d\n" f.expressions;
Printf.printf "instructions: %d\n" f.instructions;
Printf.printf "integralVars: (%d,%d)\n" (fst f.integralVars) (snd f.integralVars);
Printf.printf "arrayVars: (%d,%d)\n" (fst f.arrayVars) (snd f.arrayVars);
Printf.printf "pointerVars: (%d,%d)\n" (fst f.pointerVars) (snd f.pointerVars);
flush stdout;
Logs.debug "functions: %d" f.functions;
Logs.debug "functionCalls: %d" f.functionCalls;
Logs.debug "loops: %d" f.loops;
Logs.debug "loopBreaks: %d" f.loopBreaks;
Logs.debug "controlFlowStatements: %d" f.controlFlowStatements;
Logs.debug "expressions: %d" f.expressions;
Logs.debug "instructions: %d" f.instructions;
Logs.debug "integralVars: (%d,%d)" (fst f.integralVars) (snd f.integralVars);
Logs.debug "arrayVars: (%d,%d)" (fst f.arrayVars) (snd f.arrayVars);
Logs.debug "pointerVars: (%d,%d)" (fst f.pointerVars) (snd f.pointerVars)


class collectComplexityFactorsVisitor(factors) = object
Expand Down
2 changes: 1 addition & 1 deletion src/cdomains/valueDomain.ml
Original file line number Diff line number Diff line change
Expand Up @@ -502,7 +502,7 @@ struct

let warn_type op x y =
if GobConfig.get_bool "dbg.verbose" then
ignore @@ printf "warn_type %s: incomparable abstr. values %s and %s at %a: %a and %a\n" op (tag_name (x:t)) (tag_name (y:t)) CilType.Location.pretty !Tracing.current_loc pretty x pretty y
Logs.debug "warn_type %s: incomparable abstr. values %s and %s at %a: %a and %a" op (tag_name (x:t)) (tag_name (y:t)) CilType.Location.pretty !Tracing.current_loc pretty x pretty y

let rec leq x y =
match (x,y) with
Expand Down
2 changes: 1 addition & 1 deletion src/domains/mapDomain.ml
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ struct
)

(* uncomment to easily check pretty's grouping during a normal run, e.g. ./regtest 01 01: *)
(* let add k v m = let _ = Pretty.printf "%a\n" pretty m in M.add k v m *)
(* let add k v m = let _ = Logs.debug "%a" pretty m in M.add k v m *)

let arbitrary () = QCheck.always M.empty (* S TODO: non-empty map *)

Expand Down
4 changes: 2 additions & 2 deletions src/domains/printable.ml
Original file line number Diff line number Diff line change
Expand Up @@ -146,12 +146,12 @@ struct
let equal_debug x y = (* This debug version checks if we call hashcons enough to have up-to-date tags. Comment out the equal below to use this. This will be even slower than with hashcons disabled! *)
if x.BatHashcons.tag = y.BatHashcons.tag then ( (* x.BatHashcons.obj == y.BatHashcons.obj || *)
if not (Base.equal x.BatHashcons.obj y.BatHashcons.obj) then
ignore @@ Pretty.printf "tags are equal but values are not for %a and %a\n" pretty x pretty y;
Logs.error "tags are equal but values are not for %a and %a" pretty x pretty y;
assert (Base.equal x.BatHashcons.obj y.BatHashcons.obj);
true
) else (
if Base.equal x.BatHashcons.obj y.BatHashcons.obj then
ignore @@ Pretty.printf "tags are not equal but values are for %a and %a\n" pretty x pretty y;
Logs.error "tags are not equal but values are for %a and %a" pretty x pretty y;
assert (not (Base.equal x.BatHashcons.obj y.BatHashcons.obj));
false
)
Expand Down
6 changes: 3 additions & 3 deletions src/framework/analyses.ml
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ struct
in
let write_file f fn =
Messages.xml_file_name := fn;
BatPrintf.printf "Writing xml to temp. file: %s\n%!" fn;
Logs.info "Writing xml to temp. file: %s" fn;
BatPrintf.fprintf f "<run>";
BatPrintf.fprintf f "<parameters>%s</parameters>" GobSys.command_line;
BatPrintf.fprintf f "<statistics>";
Expand Down Expand Up @@ -292,7 +292,7 @@ struct
(*let p_fun f x = p_obj f [ "name", BatString.print, x; "nodes", p_list p_node, SH.find_all funs2node x ] in*)
let p_file f x = fprintf f "{\n \"name\": \"%s\",\n \"path\": \"%s\",\n \"functions\": %a\n}" (Filename.basename x) x (p_list p_fun) (SH.find_all file2funs x) in
let write_file f fn =
printf "Writing json to temp. file: %s\n%!" fn;
Logs.info "Writing json to temp. file: %s" fn;
fprintf f "{\n \"parameters\": \"%s\",\n " GobSys.command_line;
fprintf f "\"files\": %a,\n " (p_enum p_file) (SH.keys file2funs);
fprintf f "\"results\": [\n %a\n]\n" printJson (Lazy.force table);
Expand All @@ -307,7 +307,7 @@ struct
write_file f (get_string "outfile")
| "sarif" ->
let open BatPrintf in
printf "Writing Sarif to file: %s\n%!" (get_string "outfile");
Logs.info "Writing Sarif to file: %s" (get_string "outfile");
sim642 marked this conversation as resolved.
Show resolved Hide resolved
Yojson.Safe.to_channel ~std:true out (Sarif.to_yojson (List.rev !Messages.Table.messages_list));
| "json-messages" ->
let json = `Assoc [
Expand Down
2 changes: 1 addition & 1 deletion src/framework/cfgTools.ml
Original file line number Diff line number Diff line change
Expand Up @@ -475,7 +475,7 @@ let createCFG (file: file) =
);
if Messages.tracing then Messages.trace "cfg" "CFG building finished.\n\n";
if get_bool "dbg.verbose" then
ignore (Pretty.eprintf "cfgF (%a), cfgB (%a)\n" GobHashtbl.pretty_statistics (GobHashtbl.magic_stats cfgF) GobHashtbl.pretty_statistics (GobHashtbl.magic_stats cfgB));
Logs.debug "cfgF (%a), cfgB (%a)" GobHashtbl.pretty_statistics (GobHashtbl.magic_stats cfgF) GobHashtbl.pretty_statistics (GobHashtbl.magic_stats cfgB);
cfgF, cfgB, skippedByEdge

let createCFG = Timing.wrap "createCFG" createCFG
Expand Down
Loading
Loading