Logs
Write logs from functions with the console, browse and filter them in the panel or over the API, and send them to stdout for your log platform.
Everything a function writes with console is captured, tagged with the function and the event, and stored by Spica.
export default function (req) {
console.debug("query", JSON.stringify(req.query));
console.info(`Greeting ${req.query.name}`);
console.warn("Long name received", req.query.name.length);
console.error("Something failed");
console.log("Plain log line");
}Levels
| Method | Level | Value |
|---|---|---|
console.debug | Debug | 0 |
console.log | Log | 1 |
console.info | Info | 2 |
console.warn | Warning | 3 |
console.error | Error | 4 |
Levels are recorded when --function-logger is on, which is the default.
In the panel
Open Functions → Logs to see logs of every function on a timeline, filter them by level, function, time range and text, and expand an entry to see its details.

Over the API
/function-logs| Query parameter | Description |
|---|---|
functions | Function ids. Repeat for several. |
levels | Level values, for example levels=3&levels=4 for warnings and errors. |
content | Text to search for. |
begin, end | Time range. Defaults to the current day. |
channel | stdout or stderr. |
limit, skip | Pagination. |
curl -G https://api.example.com/api/function-logs \
-H "Authorization: APIKEY <key>" \
--data-urlencode "functions=<functionId>" \
--data-urlencode "levels=4" \
--data-urlencode "limit=20"[
{
"_id": "6b0b1a67a5611972c29c261e",
"function": "hello",
"event_id": "2u2l9r31mx0qedf6",
"channel": "stdout",
"level": 1,
"content": "New post created 6b0b1a67a5611972c29c261c",
"created_at": "2026-11-28T18:16:07.799Z"
}
]DELETE /function-logs/<functionId> removes the logs of a function.
Retention
Logs expire after --common-log-lifespan seconds, one month by default. The same setting applies to activity and status records.
Sending logs to your platform
Choose where worker output goes with --function-worker-log-output:
| Value | Effect |
|---|---|
database (default) | Stored by Spica and visible in the panel and API. |
stdout | Written to the API container's standard output, for Loki, CloudWatch, Datadog and similar tools. |
database,stdout | Both. |
Add --function-invocation-logs=true to also log every invocation to stdout.
Good logging
- Log identifiers (
documentKey, user ids, order ids) so you can correlate events. - Use
warnanderrorfor things someone should look at, and filter on them. - Don't log secrets, tokens or personal data.
- Keep
debuglogs cheap, or remove them once a function is stable.