From f8cfd8be727307166abd0513e6df25e9778d3b63 Mon Sep 17 00:00:00 2001 From: Yasunari Watanabe Date: Tue, 5 Aug 2025 05:30:36 +0000 Subject: [PATCH] log: show no backtrace by default this changes the current behavior, which is to show backtrace when [backtrace] arg provided but OCAMLRUNPARAM=b --- log.ml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/log.ml b/log.ml index 51574cd..4ab2bc2 100644 --- a/log.ml +++ b/log.ml @@ -142,7 +142,7 @@ let read_env_config = State.read_env_config (** param [lines]: whether to split multiline message as separate log lines (default [true]) - param [backtrace]: whether to show backtrace (default is [true] if [exn] is given and backtrace recording is enabled) + param [backtrace]: whether to show backtrace if [exn] is given (default is [false]) param [saved_backtrace]: supply backtrace to show instead of using [Printexc.get_backtrace] *) @@ -163,7 +163,7 @@ let make_s output_line = output lines facil (s ^ " : exn " ^ Exn.str exn ^ (if bt = [] then " (no backtrace)" else "")); List.iter (fun line -> output_line facil (" " ^ line)) bt in - fun ?exn ?(lines=true) ?backtrace ?saved_backtrace s -> + fun ?exn ?(lines=true) ?(backtrace=false) ?saved_backtrace s -> try match exn with | None -> output lines facil s @@ -171,7 +171,7 @@ let make_s output_line = match saved_backtrace with | Some bt -> print_bt lines exn bt s | None -> - match Option.default (Printexc.backtrace_status ()) backtrace with + match backtrace with | true -> print_bt lines exn (Exn.get_backtrace ()) s | false -> output lines facil (s ^ " : exn " ^ Exn.str exn) with exn ->