Skip to content

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 ✅ Yes Something went wrong
warn ✅ Yes Unexpected but recoverable situation
info ✅ Yes Regular progress updates visible to the user
debug ❌ No Internal details not relevant to the user

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 info for messages the user should see, such as progress updates and results
  • Use debug for internal details that aid development but are not relevant to end users
  • Do not flood the log output view with excessive info messages
  • For critical notifications that need immediate attention, consider using the Notification component instead