Skip to content

Log

Structured logging with levels and timestamps.

Functions

Log.info(msg: string)

Log.warn(msg: string)

Log.error(msg: string)

Log.debug(msg: string)

Log a message at the specified level. Output goes to stderr with ISO 8601 timestamps.

wyn
Log.info("server started on port 8080")
Log.warn("high memory usage: 85%")
Log.error("connection refused")
Log.debug("processing request #42")

Output:

[INFO] 2026-02-24T10:30:00 server started on port 8080
[WARN] 2026-02-24T10:30:00 high memory usage: 85%
[ERROR] 2026-02-24T10:30:00 connection refused
[DEBUG] 2026-02-24T10:30:00 processing request #42

Log.set_level(level: int)

Set the minimum log level. Messages below this level are suppressed.

LevelValue
DEBUG0
INFO1
WARN2
ERROR3
wyn
Log.set_level(2)          // Only WARN and ERROR
Log.debug("hidden")       // suppressed
Log.info("hidden")        // suppressed
Log.warn("visible")       // printed
Log.error("visible")      // printed

Example: Web Server Logging

wyn
Log.info("starting server")
var server = Http.listen(8080)
Log.info("listening on :8080")

while true {
    var req = Http.accept(server)
    Log.info("request: " + req)
    Http.respond(req, 200, "OK")
}

MIT License