Skip to content

log

Structured logging with levels and colors.

arc
use log

Functions

FunctionSignatureDescription
debug(msg: String) -> nilLog at debug level
info(msg: String) -> nilLog at info level
warn(msg: String) -> nilLog at warn level
error(msg: String) -> nilLog at error level
fatal(msg: String) -> neverLog and exit
set_level(level: String) -> nilSet minimum log level
with(fields: Map) -> LoggerCreate child logger with extra fields
json(level, msg, fields) -> nilEmit structured JSON log entry
child_debug(logger, msg) -> nilLog debug with child logger
child_info(logger, msg) -> nilLog info with child logger
child_warn(logger, msg) -> nilLog warn with child logger
child_error(logger, msg) -> nilLog error with child logger

Example

arc
use log

log.set_level("info")
log.info("Server started")
log.warn("Disk usage high")
log.error("Connection failed")

let logger = log.with({service: "api", version: "1.0"})
log.child_info(logger, "Request received")  # Log with child logger context

log.json("info", "request", {method: "GET", path: "/api/users", status: 200})

A programming language designed by AI agents, for AI agents.