Skip to content

debug

debug returns a Task that prints state of Tasks, Tags, and Spots to the console — grouped per target. Without it, you’d write that Task by hand and wrap every read in optional:

createTask({
name: "debug",
run: {
context: {
auth: {
status: auth.status,
result: optional(auth.result),
error: optional(auth.error),
},
userId: optional(userId.value),
},
fn: (ctx) => {
console.group("[Task]: auth")
console.info(ctx.auth)
console.groupEnd()
console.group("[Tag]: userId")
console.info(ctx.userId)
console.groupEnd()
},
},
})
debug(auth, userId)
▾ [coda] debug
▾ [Task]: auth
{ status: …, result: …, error: … }
▾ [Tag]: userId

targets — Tasks, Tags, and Spots to inspect. A mix is fine.

Task — a Task you compose with .step(...).

Pass an options object first to set the console group label:

debug(auth, fetchOrder)
debug({ name: "post-login" }, auth, fetchOrder)
▾ [coda] debug post-login
  • options{ name: string } sets the group label in the console.
  • targets — Tasks, Tags, and Spots to inspect. A mix is fine.

Task — a Task you compose with .step(...).