When writing/adjusting code, treat logging as part of error handling:
error/exception (not warning).except blocks, prefer get_logger().exception(...) (or error(...)) and include identifying context (IDs, URLs, comment_id, PR/issue number) so logs are traceable.artifact={...}) rather than passing arbitrary objects (like dicts) as separate arguments to the logger—this can cause formatting/type issues.print statements for debug; use get_logger().debug(...) with the same context.Example pattern:
try:
...
except Exception as e:
get_logger().exception(
"Failed to publish inline code comments fallback",
artifact={
"comment_id": comment_id,
"error": repr(e),
"pr_number": pr_number,
},
)
raise
For non-exception unexpected formats:
get_logger().warning(
"Unexpected response format",
artifact={"response": str(response_tuple)},
)