Skip to content

Commit

Permalink
doc: stderrAsMessages is now the default on the cmdline as well (#4955
Browse files Browse the repository at this point in the history
)
  • Loading branch information
Kha authored Aug 8, 2024
1 parent 7ef2d2f commit c24d218
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions doc/dev/debugging.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Some notes on how to debug Lean, which may also be applicable to debugging Lean

## Tracing

In `CoreM` and derived monads, we use `trace![traceCls] "msg with {interpolations}"` to fill the structured trace viewable with `set_option trace.traceCls true`.
In `CoreM` and derived monads, we use `trace[traceCls] "msg with {interpolations}"` to fill the structured trace viewable with `set_option trace.traceCls true`.
New trace classes have to be registered using `registerTraceClass` first.

Notable trace classes:
Expand All @@ -22,7 +22,9 @@ Notable trace classes:

In pure contexts or when execution is aborted before the messages are finally printed, one can instead use the term `dbg_trace "msg with {interpolations}"; val` (`;` can also be replaced by a newline), which will print the message to stderr before evaluating `val`. `dbgTraceVal val` can be used as a shorthand for `dbg_trace "{val}"; val`.
Note that if the return value is not actually used, the trace code is silently dropped as well.
In the language server, stderr output is buffered and shown as messages after a command has been elaborated, unless the option `server.stderrAsMessages` is deactivated.

By default, such stderr output is buffered and shown as messages after a command has been elaborated, which is necessary to ensure deterministic ordering of messages under parallelism.
If Lean aborts the process before it can finish the command or takes too long to do that, using `-DstderrAsMessages=false` avoids this buffering and shows `dbg_trace` output (but not `trace`s or other diagnostics) immediately.

## Debuggers

Expand Down

0 comments on commit c24d218

Please sign in to comment.