Logging

2 min read

Each workspace is shipped with a simple built-in logging facility. You can use this to find errors that occurred in your flows, or you can write your own log data from custom scripts. Each workspace has 5MB of log data. Newer log entries will overwrite the oldest entries when the logs are full. The logs are accessible via the "Logs" link in the main menu.

Custom log entries can be added with the Logs block. You can add additional data properties that are visible in the log entry. It is possible to filter logs on properties that have a scalar type (string, number, or boolean).

Log entries can be read and written from custom scripts. All available functions are in the global logs object. Methods are:

  • add(name: string, data: LogsData) where LogsData is an object that should have the "message" key.
  • list(criteria: LogsCriteria, limit?: number, offset?: number) where LogsCriteria is an object with filter properties, and optionally $search for fulltext search. It returns a promise that resolves to {count: number! items: {date: string; name: string; data: LogsData;}[]}
  • find(criteria: LogsCriteria) is similar to list, but resolves to a single log entry.
  • getLength returns a promise that resolves to the number of log entries currently stored
  • getUsage returns a promise that resolves to the used percentage of available logs storage.
  • getSize returns a promise that resolves to the available log storage in bytes.

The logging mechanism is designed to favor the speed of writing over reading. Therefore, it is not recommended to misuse the logs for purposes other than logging, like caching items.