Avoid unnecessary call to id() in ::erase

Change-Id: I21e0cd5a03ee06db17b8d3ed7b712b3d350b6a5f
Signed-off-by: Marri Devender Rao <devenrao@in.ibm.com>
diff --git a/log_manager.cpp b/log_manager.cpp
index bd36d66..fbf6682 100644
--- a/log_manager.cpp
+++ b/log_manager.cpp
@@ -217,12 +217,11 @@
 void Manager::erase(uint32_t entryId)
 {
     auto entry = entries.find(entryId);
-    auto id = entry->second->id();
     if(entries.end() != entry)
     {
         // Delete the persistent representation of this error.
         fs::path errorPath(ERRLOG_PERSIST_PATH);
-        errorPath /= std::to_string(id);
+        errorPath /= std::to_string(entryId);
         fs::remove(errorPath);
         if (entry->second->severity() >= Entry::sevLowerLimit)
         {
@@ -234,6 +233,11 @@
         }
         entries.erase(entry);
     }
+    else
+    {
+        logging::log<level::ERR>("Invalid entry ID to delete",
+                logging::entry("ID=%d", entryId));
+    }
 
     size_t realErrCnt = entries.size() - infoErrors.size();