0 | ||| Backend-agnostic log rendering.
 1 | |||
 2 | ||| A `LogRenderer` describes how to build structured output of type `r`
 3 | ||| from log fields. Different backends (text, JSON, key-value pairs)
 4 | ||| provide different `LogRenderer` implementations. A single `Loggable`
 5 | ||| instance works with any renderer.
 6 | module Log4Types.Core.Renderer
 7 |
 8 | import Log4Types.Core.Value
 9 |
10 | %default total
11 |
12 | ||| A backend-agnostic renderer for structured log output.
13 | |||
14 | ||| This is a record (not an interface) so multiple renderers can coexist
15 | ||| in the same program without orphan instance issues.
16 | public export
17 | record LogRenderer (r : Type) where
18 |   constructor MkLogRenderer
19 |   ||| Add a named field with a primitive value.
20 |   addField  : String -> LogParamValue -> r -> r
21 |   ||| Add a named nested object (the function builds the nested content).
22 |   addNested : String -> (r -> r) -> r -> r
23 |   ||| The empty output (identity for `combine`).
24 |   empty     : r
25 |   ||| Merge two outputs.
26 |   combine   : r -> r -> r
27 |