You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
refactor: handle error and warning logs consistently (#862)
Before, most Verso monads and functions threaded IO actions for logging
errors, and each monad had a bespoke error reporting function. These
grew organically, and were largely a set of IO actions attached to
various reader contexts.
Now, they're all unified with a single logging type class, a single
canonical monad transformer, as well as a single way to actually print
the error report to the console when finished. Many type parameters on
contexts could be removed. This makes it much easier to work on Verso.
Additionally, warning logs were added in order to prepare for an
upcoming feature.
Copyright (c) 2026 Lean FRO LLC. All rights reserved.
3
+
Released under Apache 2.0 license as described in the file LICENSE.
4
+
Author: David Thrane Christiansen
5
+
-/
6
+
7
+
import VersoManual
8
+
9
+
open Verso.Genre Manual InlineLean
10
+
11
+
12
+
#doc (Manual) "Verso 4.31.0 (unreleased)" =>
13
+
%%%
14
+
tag := "release-v4.31.0"
15
+
file := "v4.31.0"
16
+
%%%
17
+
18
+
* Refactored the build's error reporting into a {ref "feat-build-log"}[logging abstraction] with severities and structured source locations, improving the consistency of Verso's internal APIs and external error reports.
19
+
While this was primarily an internal change, there is a {ref "feat-build-log-breaking"}[breaking change] to the signature of {name}`Verso.Genre.Manual.ExtraStep`.
20
+
21
+
# Logging Abstraction
22
+
%%%
23
+
tag := "feat-build-log"
24
+
%%%
25
+
26
+
The build pipeline previously threaded a bare `String → IO Unit` error callback through traversal and output generation, and several monads carried their own ad-hoc error loggers.
27
+
There was no way to emit a warning.
28
+
29
+
This release introduces {name}`Verso.MonadBuildLog`, a uniform logging interface shared across the genres.
30
+
A message carries a {name}`Verso.Severity` (either {name}`Verso.Severity.error` or {name}`Verso.Severity.warning`) and an optional source location.
31
+
32
+
33
+
## Breaking Change: `ExtraStep`
34
+
%%%
35
+
tag := "feat-build-log-breaking"
36
+
%%%
37
+
38
+
{name}`Verso.Genre.Manual.ExtraStep` no longer takes a `String → IO Unit` error callback.
39
+
Instead, it runs in a monad that has an instanceof {name}`Verso.MonadBuildLog`, so a step can emit both errors and warnings with {name}`Verso.reportError` and {name}`Verso.reportWarning`.
0 commit comments