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 #42Log.set_level(level: int)
Set the minimum log level. Messages below this level are suppressed.
| Level | Value |
|---|---|
| DEBUG | 0 |
| INFO | 1 |
| WARN | 2 |
| ERROR | 3 |
wyn
Log.set_level(2) // Only WARN and ERROR
Log.debug("hidden") // suppressed
Log.info("hidden") // suppressed
Log.warn("visible") // printed
Log.error("visible") // printedExample: 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")
}