Skip to content

Logging ​

Implementation status: levels + structured field lines Implemented; not JSON logging GA. Import the module as Logging; the type surface is still Log.

swift
import Logging

func main() {
    Log.setMinLevel("INFO")
    Log.info("hello-log")
    print(Log.takeLast())
}

Example: examples/log_fields.sy

APIDescription
debug / info / warn / errorPlain message
setMinLevel / minLevelGlobal floor: DEBUG / INFO / WARN / ERROR
infoFields and friendsStructured fields; empty string when below the floor
takeLastReads out the most recent successfully emitted line (for testing filtering)
policyPolicy fingerprint; ≠ JSON GA

Metrics / Tracing / Profiling are adjacent observability packages on importable_modules; this chapter does not treat them as a product observability GA.

SYX · Apache-2.0