Improve logging for deleted persistent storage records.

Log at ERROR level if an unfinished action record is being deleted from persistent storage, as only completed actions are expected to be removed.

This will help give us more insight into which actions are being deleted.

PiperOrigin-RevId: 835313762
Change-Id: I34b18baf28e066c65e1275ee2dc4a22a5717fbdb
diff --git a/persistent_storage_impl.cc b/persistent_storage_impl.cc
index bdff4a3..2ea09d5 100644
--- a/persistent_storage_impl.cc
+++ b/persistent_storage_impl.cc
@@ -327,7 +327,13 @@
   auto end_delete = std::next(records.begin(), num_to_delete);
   for (auto i = records.begin(); i != end_delete; i++) {
     auto action_to_delete = i->actions().original_request().flight_record();
-    LOG(INFO) << "deleting proto:" << action_to_delete << std::endl;
+    // In ideal circumstances, only actions that are completed are deleted.
+    if (AtEndState(i->actions())) {
+      LOG(INFO) << "deleting end-state action record:" << action_to_delete;
+    } else {
+      LOG(ERROR) << "deleting an unfinished action record:"
+                 << action_to_delete;
+    }
     map.erase(action_to_delete);
   }
   return absl::OkStatus();