Function system logs for runtime events
Published: January 29, 2026
We've enhanced Sanity Functions with automatic system logging that gives you better visibility into why your functions are or aren't running. The runtime now injects system logs directly into your function's log stream for key operational events.
Automatic system logs
Previously, when a function didn't run, it could be unclear why. Was it rate limited? Did it hit a recursion limit? Was the project over quota? You'd need to reach out to support channels to understand what happened.
Your function logs now include system-generated messages for important runtime events like rate limiting, quota exhaustion, and recursion blocking. These logs appear alongside your function's own console output, making it easier to diagnose issues without having to reach out to support.
New log events
The system automatically logs the following events:
- Function invocation: When your function successfully starts executing.
- Rate limiting: When your function is temporarily blocked because too many invocations were triggered in a short period (this protects against infinite loops and runaway executions).
- Quota exceeded: When your project has reached its monthly function execution limit.
- Max recursion: When a function triggers itself (or other functions in a chain) too many times in sequence, creating a recursive loop that exceeds the maximum depth limit.
- Invocation failures: When the function invocation itself fails (detailed error information appears in adjacent log entries).
Example log output
When viewing your function logs in the CLI (npx -y sanity@latest functions logs --watch) or in your project dashboard, system messages appear with color-coded severity levels:
2026-01-28 23:00:00.000 INFO Function invocation started
2026-01-28 23:00:01.000 WARN Maximum recursion depth exceeded: function invocation blocked
2026-01-28 23:00:02.000 WARN Quota exceeded: function invocation blocked
2026-01-28 23:00:03.000 WARN Rate limit exceeded: function invocation blocked
2026-01-28 23:00:04.000 ERROR Function invocation failed