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

Provide command line flag for debug logging level #898

Merged
merged 3 commits into from
Oct 24, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
5 changes: 0 additions & 5 deletions src/base/Checker.ml
Original file line number Diff line number Diff line change
Expand Up @@ -358,11 +358,6 @@ let run args ~exe_name =
let lib_dirs = StdlibTracker.get_stdlib_dirs () in
if List.is_empty lib_dirs then stdlib_not_found_err ~exe_name ();

(* Testsuite runs this executable with cwd=tests and ends
up complaining about missing _build directory for logger.
So disable the logger. *)
set_debug_level Debug_None;

let open FilePath in
let open StdlibTracker in
if check_extension cli.input_file file_extn_library then
Expand Down
12 changes: 11 additions & 1 deletion src/base/RunnerUtil.ml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ open RUSyntax

let get_init_extlibs filename =
if not (Caml.Sys.file_exists filename) then (
plog (sprintf "Invalid init json %s file" filename);
plog (sprintf "Invalid init json file %s\n" filename);
[] )
else
try
Expand Down Expand Up @@ -412,6 +412,16 @@ let parse_cli args ~exe_name =
( "-typeinfo",
Arg.Unit (fun () -> r_type_info := true),
"Print types of variables with location" );
( "-debuglevel",
Arg.Symbol
( [ "none"; "normal"; "verbose" ],
fun s ->
match s with
| "none" -> GlobalConfig.set_debug_level Debug_None
| "normal" -> GlobalConfig.set_debug_level Debug_Normal
| "verbose" -> GlobalConfig.set_debug_level Debug_Verbose
| _ -> raise (ErrorUtils.FatalError "Invalid debug log level") ),
"Set debug logging level" );
( "-disable-validate-json",
Arg.Unit (fun () -> r_validate_json := false),
"Disable validation of input JSONs" );
Expand Down
10 changes: 10 additions & 0 deletions src/eval/RunnerCLI.ml
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,16 @@ let parse args ~exe_name =
( "-jsonerrors",
Arg.Unit (fun () -> b_json_errors := true),
"Print errors in JSON format" );
( "-debuglevel",
Arg.Symbol
( [ "none"; "normal"; "verbose" ],
fun s ->
match s with
| "none" -> GlobalConfig.set_debug_level Debug_None
| "normal" -> GlobalConfig.set_debug_level Debug_Normal
| "verbose" -> GlobalConfig.set_debug_level Debug_Verbose
| _ -> raise (ErrorUtils.FatalError "Invalid debug log level") ),
": Set debug logging level" );
( "-disable-pp-json",
Arg.Unit (fun () -> b_pp_json := false),
"Disable pretty printing of JSONs" );
Expand Down
1 change: 0 additions & 1 deletion src/runners/type_checker.ml
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,6 @@ let run () =
let cli = parse_cli None ~exe_name:Sys.argv.(0) in
let open GlobalConfig in
StdlibTracker.add_stdlib_dirs cli.stdlib_dirs;
set_debug_level Debug_None;
let filename = cli.input_file in
let gas_limit = cli.gas_limit in
match FrontEndParser.parse_file Parser.Incremental.exp_term filename with
Expand Down