Skip to content
Snippets Groups Projects
Commit 68ebd47f authored by Julien Girard-Satabin's avatar Julien Girard-Satabin Committed by Michele Alberti
Browse files

More consistant logging

parent 1e821ab2
No related branches found
No related tags found
No related merge requests found
...@@ -244,8 +244,7 @@ let create_nn_onnx = ...@@ -244,8 +244,7 @@ let create_nn_onnx =
Logs.warn (fun m -> Logs.warn (fun m ->
m "Cannot build network intermediate representation:@ %s" msg); m "Cannot build network intermediate representation:@ %s" msg);
None None
| Ok nier -> | Ok nier -> Some nier
Some nier
in in
{ {
nn_nb_inputs = n_inputs; nn_nb_inputs = n_inputs;
......
...@@ -81,6 +81,9 @@ let code_error ?src f = ...@@ -81,6 +81,9 @@ let code_error ?src f =
exception User_error exception User_error
let info ?src f =
Logs.info ?src f
let user_error ?src f = let user_error ?src f =
Logs.err ?src f; Logs.err ?src f;
raise User_error raise User_error
......
...@@ -38,6 +38,9 @@ val setup : ...@@ -38,6 +38,9 @@ val setup :
val is_debug_level : Logs.src -> bool val is_debug_level : Logs.src -> bool
val info : ?src:Logs.src -> (_, unit) Logs.msgf -> unit
(** Log a message to the user and continue the execution. *)
val code_error : ?src:Logs.src -> (_, unit) Logs.msgf -> 'b val code_error : ?src:Logs.src -> (_, unit) Logs.msgf -> 'b
(** Terminate execution with a [code error] message. *) (** Terminate execution with a [code error] message. *)
......
...@@ -261,11 +261,10 @@ let answer_generic limit config prover config_prover driver ~proof_strategy ...@@ -261,11 +261,10 @@ let answer_generic limit config prover config_prover driver ~proof_strategy
| Some { nn_nier = Some g; _ } -> ( | Some { nn_nier = Some g; _ } -> (
try try
Onnx.write g f; Onnx.write g f;
Logs.info (fun m -> m "@[Wrote ONNX file at '%s'@]" f) Logging.info (fun m -> m "@[Wrote ONNX file at '%s'@]" f)
with Sys_error msg -> with Sys_error msg ->
Logs.err (fun m -> Logging.user_error (fun m ->
m "@[System error: tried to write ONNX file a '%s', got '%s'@]" m "@[Tried to write ONNX file at '%s', got '%s'@]" f msg))
f msg))
| None -> () | None -> ()
| _ -> () | _ -> ()
in in
......
...@@ -4,7 +4,7 @@ Test verify ...@@ -4,7 +4,7 @@ Test verify
$ bin/pyrat.py --version $ bin/pyrat.py --version
PyRAT 1.1 PyRAT 1.1
$ caisar verify --format whyml --prover=PyRAT --onnx-out-file="out.onnx" - 2>&1 <<EOF | ./filter_tmpdir.sh $ caisar verify --format whyml --prover=PyRAT -v --onnx-out-file="out.onnx" - 2>&1 <<EOF | ./filter_tmpdir.sh
> theory NIER_to_ONNX > theory NIER_to_ONNX
> use ieee_float.Float64 > use ieee_float.Float64
> use bool.Bool > use bool.Bool
...@@ -21,6 +21,8 @@ Test verify ...@@ -21,6 +21,8 @@ Test verify
> (0.5:t) .< (nn@@i)[0] .< (0.5:t) > (0.5:t) .< (nn@@i)[0] .< (0.5:t)
> end > end
> EOF > EOF
[INFO] Wrote ONNX file at 'out.onnx'
[INFO] Verification results for theory 'NIER_to_ONNX'
Goal G: Unknown () Goal G: Unknown ()
Data should be 0.135 Data should be 0.135
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment