summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarri Devender Rao <devenrao@in.ibm.com>2017-11-17 00:13:41 -0600
committerMarri Devender Rao <devenrao@in.ibm.com>2017-11-17 06:45:45 -0600
commit8959efcb5881a1970b2057466d0267c563772208 (patch)
treece8855289a0073f9750423e7ba3c48a21ead33c2
parent7aafb12ea6d143a694080733b2f65216c8c9c892 (diff)
downloadphosphor-logging-8959efcb5881a1970b2057466d0267c563772208.tar.gz
phosphor-logging-8959efcb5881a1970b2057466d0267c563772208.zip
Avoid unnecessary call to id() in ::erase
Change-Id: I21e0cd5a03ee06db17b8d3ed7b712b3d350b6a5f Signed-off-by: Marri Devender Rao <devenrao@in.ibm.com>
-rw-r--r--log_manager.cpp8
1 files changed, 6 insertions, 2 deletions
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::processMetadata(const std::string& errorName,
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 @@ void Manager::erase(uint32_t entryId)
}
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();
OpenPOWER on IntegriCloud