Describe JSON serialization of metadata in docs

This commit is contained in:
T. R. Bernstein
2026-03-02 19:21:17 +01:00
parent d22556d04e
commit b48562c2b0

View File

@@ -66,6 +66,13 @@ func init() {
"main": Logger(label: "com.example.yourapp.Main"), "main": Logger(label: "com.example.yourapp.Main"),
"mail": Logger(label: "com.example.yourapp.Mail System"), "mail": Logger(label: "com.example.yourapp.Mail System"),
] ]
// And using loggers
logger["main"]!.debug("Starting build",
metadata: [
"input.output_directory": "\(output)",
"input.data": "\(data ?? "-")"
])
} }
``` ```
@@ -78,6 +85,9 @@ library maps a reverse domain style label to the subsystem and category
parameters of the unified logging system. See parameters of the unified logging system. See
``/LoggingOSLog/LoggingOSLog/init(label:)`` for more information. ``/LoggingOSLog/LoggingOSLog/init(label:)`` for more information.
Metadata is appended as JSON to the logged message after an ASCII right
arrow ("->").
### What this library does not supply ### What this library does not supply
This library does not implement any of the interpolation privacy features of This library does not implement any of the interpolation privacy features of
the unified logging system, i.e. there is no way to redact or align a meta the unified logging system, i.e. there is no way to redact or align a meta