conv.log
lets your function write small, structured log entries that show up in Conversation Review → Diagnosis and in the Conversations API. Use it for breadcrumbs, warnings, and errors.
Logging is part of the core
Conversation
object. It lives on conv.log
, not conv.utils
.Methods
log.info(message)
log.info(message)
Description: Add a routine breadcrumb.Example:
log.warning(message)
log.warning(message)
Description: Flag a soft failure or approaching limit.Example:
log.error(message)
log.error(message)
Description: Record a handled failure with context.Example:
PII
Setis_pii=True
when the message or fields contain personally identifiable information.
Where it appears
- Conversation Review → Diagnosis: grouped under the turn’s function event.
- Conversations API: returned on function events as
logs.conversation_logger
.
Entry shape
Each call produces a JSON object like this:Patterns
ValidationBest practices
- Keep messages short; put details in fields.
- Log at decision points, not in tight loops.
- Prefer identifiers over payload dumps.
- Default to
is_pii=True
if you’re unsure.