Log
The Log handler pushes runtime messages from a Connected App into Facilio Logs > Connected App Logs. Use it to capture debug context while building, and to record exceptions from catch blocks so they can be investigated later.
Like api, interface, and request, log is a handler on the SDK instance — call it as window.facilioApp.log.info(...) or window.facilioApp.log.error(...).
Auto-captured errors
Uncaught runtime errors inside a Connected App (e.g. SyntaxError, accessing a property on undefined, unhandled promise rejections) are automatically pushed to Facilio Logs > Connected App Logs. You only need to call log.error() for errors you catch yourself and want to record with custom context.
| Method | Description |
|---|---|
| info | Push an informational / debug message |
| error | Push an error message with an Error or stack trace |
info#
Pushes an informational message to Facilio Logs > Connected App Logs. Use for debug breadcrumbs — values at key checkpoints, lifecycle events, branch decisions — anything you'd otherwise console.log but want to inspect across sessions in Facilio Logs > Connected App Logs.
app.log.info(message)| Param | Type | Description |
|---|---|---|
message | string | Required. Human-readable summary to record |
Example
window.facilioApp.log.info('Vendor widget loaded for record ' + record.id);
// Branch decisionsif (currentUser.role?.isSuperAdmin) { window.facilioApp.log.info('Admin view enabled for ' + currentUser.email);}error#
Pushes an error message to Facilio Logs > Connected App Logs along with its stack trace. Both arguments are required — pass the caught Error (or a pre-formatted stack string) as the second argument so the stack is recorded alongside the message.
app.log.error(message, error)| Param | Type | Description |
|---|---|---|
message | string | Required. Human-readable summary of what failed |
error | Error | string | Required. The exception object from a catch, or a pre-formatted stack string |
Example — log API failures from a catch block
try { const response = await window.facilioApp.api.fetchRecord('workorder', { id: 729857 }); // ...} catch (error) { window.facilioApp.log.error('Failed to fetch workorder 729857', error);}Example — log a connector call failure
try { const response = await window.facilioApp.request.invokeConnectorAPI('zendesk', '/api/v2/tickets.json', { method: 'POST', data: { ticket: { subject: 'AC not working' } } });} catch (error) { window.facilioApp.log.error('Zendesk ticket create failed', error);}When to use Log vs. console.log#
console.logis fine for live, in-browser debugging during development.- Use
log.info/log.errorwhen you need the message to persist in Facilio Logs > Connected App Logs — so it survives a page reload and is available to anyone investigating the issue later (including on mobile, where the browser console is not accessible). - Always pair a
catchblock withlog.error(message, error)for any API or connector call that can fail in production.