Skip to content

Commit 4ca0e4d

Browse files
committed
ppx_minidebug truncate_children config
1 parent 8003356 commit 4ca0e4d

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

arrayjit/lib/utils.ml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -398,6 +398,10 @@ let get_local_debug_runtime =
398398
(Int.of_string (String.strip id1), Int.of_string (String.strip id2)))
399399
| _ -> None)
400400
in
401+
let truncate_children =
402+
let arg = get_global_arg ~default:"" ~arg_name:"debug_log_truncate_children" in
403+
if String.is_empty arg then None else Some (Int.of_string arg)
404+
in
401405
let name = get_global_arg ~default:"debug" ~arg_name:"log_file_stem" in
402406
match (flushing, filename) with
403407
| true, None ->
@@ -410,14 +414,14 @@ let get_local_debug_runtime =
410414
| false, None ->
411415
Minidebug_runtime.prefixed_runtime ~time_tagged ~elapsed_times ~location_format
412416
~print_entry_ids ~verbose_entry_ids ~global_prefix:name ~toc_entry
413-
~toc_specific_hyperlink:"" ~highlight_terms
417+
~toc_specific_hyperlink:"" ~highlight_terms ?truncate_children
414418
~exclude_on_path:Re.(str "env")
415419
~log_level:original_log_level ?snapshot_every_sec ()
416420
| false, Some filename ->
417421
Minidebug_runtime.local_runtime ~time_tagged ~elapsed_times ~location_format ~print_entry_ids
418422
~verbose_entry_ids ~global_prefix:name ~toc_flame_graph ~flame_graph_separation:50
419423
~toc_entry ~for_append:false ~max_inline_sexp_length:120 ~hyperlink
420-
~toc_specific_hyperlink:"" ~highlight_terms
424+
~toc_specific_hyperlink:"" ~highlight_terms ?truncate_children
421425
~exclude_on_path:Re.(str "env")
422426
~backend ~log_level:original_log_level ?snapshot_every_sec ?prev_run_file
423427
?diff_ignore_pattern ?max_distance_factor ~entry_id_pairs filename

ocannl_config.example

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,10 @@ debug_entry_id_pairs=
185185
# regardless of the value of `log_main_domain_to_stdout`.
186186
log_file_stem=debug
187187

188+
# For ppx_minidebug: If given a number, sets the `truncate_children` parameter: only this number
189+
# of the most recent children of each log entry are held.`
190+
debug_log_truncate_children=
191+
188192
# It is useful for testing to have outputs more uniform across backends even if that criples
189193
# some backends. Currently, this setting only affects logging from routines to accomodate Metal's
190194
# shortcoming.

0 commit comments

Comments
 (0)