Script logging (log)
The log scope object emits structured lines through Conduit’s tracing pipeline. This is not file I/O from Rhai — messages appear in process logs with script correlation fields.
See Host API overview for how log fits alongside txn, runtime, lookup, and metrics.
Methods
Methods: log.info(msg) · log.warn(msg)
log.info(msg)
Request + response hook · msg: string · no return
Info-level script log line (rate-limited).
Behavior
- Writes at info severity with
script,rule, andtxn_idfields (same pipeline as other Conduit tracing). - Rate limit: first call per script/rule per snapshot generation, then every 100 calls.
- Messages longer than 512 characters are truncated.
- Use for debug/canary branches — not per-query logging at high QPS.
log.warn(msg)
Request + response hook · msg: string · no return
Warn-level script log line (same rate limit as log.info).
Example
if txn.has_tag("debug") {
log.info(`policy matched txn=${txn.txn_id()} pool=${txn.selected_pool()}`);
}
Pair with txn.txn_id() for correlation — see Transaction API — Introspection.
Related
- Logging — operator log configuration
- Sandbox limits — script logging rate limits
- Built-in metrics — script errors — eval failures (separate from
log)