Skip to content

Commit ae8cbdb

Browse files
committed
log: show no backtrace by default
this changes the current behavior, which is to show backtrace when [backtrace] arg provided but OCAMLRUNPARAM=b
1 parent 9b5deb3 commit ae8cbdb

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

log.ml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ let read_env_config = State.read_env_config
142142
(**
143143
param [lines]: whether to split multiline message as separate log lines (default [true])
144144
145-
param [backtrace]: whether to show backtrace (default is [true] if [exn] is given and backtrace recording is enabled)
145+
param [backtrace]: whether to show backtrace if [exn] is given (default is [false])
146146
147147
param [saved_backtrace]: supply backtrace to show instead of using [Printexc.get_backtrace]
148148
*)
@@ -163,15 +163,15 @@ let make_s output_line =
163163
output lines facil (s ^ " : exn " ^ Exn.str exn ^ (if bt = [] then " (no backtrace)" else ""));
164164
List.iter (fun line -> output_line facil (" " ^ line)) bt
165165
in
166-
fun ?exn ?(lines=true) ?backtrace ?saved_backtrace s ->
166+
fun ?exn ?(lines=true) ?(backtrace=false) ?saved_backtrace s ->
167167
try
168168
match exn with
169169
| None -> output lines facil s
170170
| Some exn ->
171171
match saved_backtrace with
172172
| Some bt -> print_bt lines exn bt s
173173
| None ->
174-
match Option.default (Printexc.backtrace_status ()) backtrace with
174+
match backtrace with
175175
| true -> print_bt lines exn (Exn.get_backtrace ()) s
176176
| false -> output lines facil (s ^ " : exn " ^ Exn.str exn)
177177
with exn ->

0 commit comments

Comments
 (0)