Skip to content

Commit 6589e02

Browse files
committed
Debug logs highlights config
1 parent 0b7ae75 commit 6589e02

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

arrayjit/lib/utils.ml

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -301,6 +301,15 @@ let get_debug name =
301301
let toc_entry =
302302
Minidebug_runtime.And (toc_entry_minimal_depth @ toc_entry_minimal_size @ toc_entry_minimal_span)
303303
in
304+
let debug_highlights =
305+
let arg = get_global_arg ~default:"" ~arg_name:"debug_highlights" in
306+
if String.is_empty arg then [] else String.split arg ~on:'|'
307+
in
308+
let highlight_re =
309+
let arg = get_global_arg ~default:"" ~arg_name:"debug_highlight_pcre" in
310+
if String.is_empty arg then [] else [ Re.Pcre.re arg ]
311+
in
312+
let highlight_terms = Re.(alt (highlight_re @ List.map debug_highlights ~f:str)) in
304313
if flushing then
305314
Minidebug_runtime.debug_flushing ?filename ~time_tagged ~elapsed_times ~print_entry_ids
306315
~verbose_entry_ids ~global_prefix:name ~for_append:false ~log_level ()
@@ -310,16 +319,15 @@ let get_debug name =
310319
Minidebug_runtime.forget_printbox
311320
@@ Minidebug_runtime.debug ~time_tagged ~elapsed_times ~location_format ~print_entry_ids
312321
~verbose_entry_ids ~global_prefix:name ~toc_entry ~toc_specific_hyperlink:""
313-
~highlight_terms:Re.(alt [ str "float *w2" ])
322+
~highlight_terms
314323
~exclude_on_path:Re.(str "env")
315324
~log_level ?snapshot_every_sec ()
316325
| Some filename ->
317326
Minidebug_runtime.forget_printbox
318327
@@ Minidebug_runtime.debug_file ~time_tagged ~elapsed_times ~location_format
319328
~print_entry_ids ~verbose_entry_ids ~global_prefix:name ~toc_flame_graph:true
320329
~flame_graph_separation:50 ~toc_entry ~for_append:false ~max_inline_sexp_length:120
321-
~hyperlink ~toc_specific_hyperlink:""
322-
~highlight_terms:Re.(alt [ str "float *w2" ])
330+
~hyperlink ~toc_specific_hyperlink:"" ~highlight_terms
323331
~exclude_on_path:Re.(str "env")
324332
~backend ~log_level ?snapshot_every_sec filename
325333

0 commit comments

Comments
 (0)