mirror of
https://github.com/CatalaLang/catala.git
synced 2024-09-19 16:28:12 +03:00
Format rather than print
This commit is contained in:
parent
579e66a500
commit
5d765676b5
@ -44,41 +44,23 @@ let log_marker ppf () =
|
||||
|
||||
(** All the printers below print their argument after the correct marker *)
|
||||
|
||||
let debug_print format =
|
||||
if !Cli.debug_flag then
|
||||
Format.printf ("%a" ^^ format ^^ "\n%!") debug_marker ()
|
||||
else Format.ifprintf Format.std_formatter format
|
||||
|
||||
let debug_format (format : ('a, Format.formatter, unit) format) =
|
||||
if !Cli.debug_flag then
|
||||
Format.printf ("%a@[<hov>" ^^ format ^^ "@]@.") debug_marker ()
|
||||
else Format.ifprintf Format.std_formatter format
|
||||
|
||||
let error_print format =
|
||||
Format.print_flush ();
|
||||
(* Flushes previous warnings *)
|
||||
Format.eprintf ("%a" ^^ format ^^ "@\n") error_marker ()
|
||||
|
||||
let error_format (format : ('a, Format.formatter, unit) format) =
|
||||
Format.print_flush ();
|
||||
(* Flushes previous warnings *)
|
||||
Format.printf ("%a" ^^ format ^^ "\n%!") error_marker ()
|
||||
|
||||
let warning_print format =
|
||||
if !Cli.disable_warnings_flag then Format.ifprintf Format.std_formatter format
|
||||
else Format.printf ("%a" ^^ format ^^ "@\n") warning_marker ()
|
||||
|
||||
let warning_format format =
|
||||
Format.printf ("%a" ^^ format ^^ "\n%!") warning_marker ()
|
||||
|
||||
let result_print format =
|
||||
Format.printf ("%a" ^^ format ^^ "\n%!") result_marker ()
|
||||
if !Cli.disable_warnings_flag then Format.ifprintf Format.std_formatter format
|
||||
else Format.printf ("%a" ^^ format ^^ "\n%!") warning_marker ()
|
||||
|
||||
let result_format format =
|
||||
Format.printf ("%a" ^^ format ^^ "\n%!") result_marker ()
|
||||
|
||||
let log_print format = Format.printf ("%a" ^^ format ^^ "\n%!") log_marker ()
|
||||
|
||||
let log_format format =
|
||||
Format.printf ("%a@[<hov>" ^^ format ^^ "@]@.") log_marker ()
|
||||
|
||||
@ -105,11 +87,11 @@ let emit_content (content : Content.t) (typ : content_type) : unit =
|
||||
match !Cli.message_format_flag with
|
||||
| Cli.Human ->
|
||||
(match typ with
|
||||
| Warning -> warning_print
|
||||
| Error -> error_print
|
||||
| Debug -> debug_print
|
||||
| Log -> log_print
|
||||
| Result -> result_print)
|
||||
| Warning -> warning_format
|
||||
| Error -> error_format
|
||||
| Debug -> debug_format
|
||||
| Log -> log_format
|
||||
| Result -> result_format)
|
||||
"%s%s%s" msg
|
||||
(if pos = [] then "" else "\n\n")
|
||||
(String.concat "\n\n"
|
||||
|
26820
french_law/js/src/french_law.js
generated
26820
french_law/js/src/french_law.js
generated
File diff suppressed because one or more lines are too long
@ -12,9 +12,6 @@ scope Test:
|
||||
|
||||
```catala-test-inline
|
||||
$ catala Interpret -s Test
|
||||
catala: internal error, uncaught exception:
|
||||
Dates_calc.Dates.AmbiguousComputation
|
||||
|
||||
[WARNING] In scope "Test", the variable "ambiguous" is never used anywhere; maybe it's unnecessary?
|
||||
|
||||
┌─⯈ tests/test_date/bad/rounding_option.catala_en:5.11-5.20:
|
||||
@ -22,5 +19,8 @@ catala: internal error, uncaught exception:
|
||||
5 │ context ambiguous content boolean
|
||||
│ ‾‾‾‾‾‾‾‾‾
|
||||
|
||||
catala: internal error, uncaught exception:
|
||||
Dates_calc.Dates.AmbiguousComputation
|
||||
|
||||
#return code 125#
|
||||
```
|
||||
|
@ -12,9 +12,6 @@ champ d'application Test:
|
||||
|
||||
```catala-test-inline
|
||||
$ catala Interpret -s Test
|
||||
catala: internal error, uncaught exception:
|
||||
Dates_calc.Dates.AmbiguousComputation
|
||||
|
||||
[WARNING] In scope "Test", the variable "ambiguité" is never used anywhere; maybe it's unnecessary?
|
||||
|
||||
┌─⯈ tests/test_date/bad/rounding_option.catala_fr:5.12-5.21:
|
||||
@ -22,5 +19,8 @@ catala: internal error, uncaught exception:
|
||||
5 │ contexte ambiguité contenu booléen
|
||||
│ ‾‾‾‾‾‾‾‾‾
|
||||
|
||||
catala: internal error, uncaught exception:
|
||||
Dates_calc.Dates.AmbiguousComputation
|
||||
|
||||
#return code 125#
|
||||
```
|
||||
|
Loading…
Reference in New Issue
Block a user