Logger Component
The logger can be used to log output to the Cereal application. Log messages are persisted and shown in the log output view, giving users real-time visibility into what a task is doing.
Log levels
| Level | Visible in log output view | When to use |
|---|---|---|
error |
✅ Always | Something went wrong |
warn |
✅ Always | Unexpected but recoverable situation |
info |
✅ Always | Regular progress updates visible to the user |
debug |
⚠️ Only when the user enables Show debug logs | Internal details not relevant to the user |
debug output is not private
Debug messages are hidden by default, but any user can reveal them by enabling Show debug logs in the Cereal
application settings. Never log secrets — API keys, credentials, tokens, or personal data — at any level,
including debug.
Usage
When implementing your script's onStart, execute, or onFinish methods, you can access the Logger component through
the provided ComponentProvider.
suspend fun execute(provider: ComponentProvider) {
val logger = provider.logger()
// Shown in the log output view
logger.info("Processing item 1/10")
logger.warn("Rate limit approaching")
logger.error("Item not found")
// Not shown in the log output view
logger.debug("Response body: $responseBody")
// Log with an exception
try {
riskyOperation()
} catch (e: Exception) {
logger.error("Operation failed", e)
}
}
Best Practices
- Use
infofor messages the user should see, such as progress updates and results - Use
debugfor internal details that aid development but are not relevant to end users — remembering that users can choose to display them - Do not flood the log output view with excessive
infomessages - For critical notifications that need immediate attention, consider using the Notification component instead