Skip to content

Log (ctx.log) ​

ctx.log writes structured log lines that operators can read after the run, on the surfaces listed below. print output is not displayed anywhere, and the type checker flags print as unknown.

FunctionLevel
ctx.log.info(message, attrs?)INFO
ctx.log.warn(message, attrs?)WARNING
ctx.log.error(message, attrs?)ERROR

The functions are synchronous and return nothing. attrs is an optional table of structured values.

lua
ctx.log.info("import started", { source = "erp", batch = 41 })
ctx.log.warn("row rejected", { row = 12, field = "quantity", value = -3 })
ctx.log.error("import aborted", { rejected = 1, reason = "invalid quantity" })

return { logged = 3 }
  • Keep the message a fixed phrase and put changing values in attrs, so lines from different runs can be grouped and searched.
  • ctx.log.error records a line; it does not stop the script. Call error(...) to stop.
  • A run keeps at most 100 log lines. Further lines are dropped, and a warning with the number of dropped lines is added.

Where the lines appear ​

SurfaceWhere to read them
Workflow script nodeThe workflow execution's logs, with the node recorded on each line
Lua PlaygroundThe Logs panel (the logs field of the playground result)
IntegrationThe integration instance's logs
Incoming webhook, custom app server scriptNot stored: the lines are discarded after the run

Lines are kept even when the script fails afterwards, which is when they matter most.

When a platform call fails (for example a device that cannot be reached), the platform writes the detailed cause into the same log, while the script receives only a short message. Check the log first when a ctx call returns false.

Connect machines, automate workflows, and build custom apps for print production.