summaryrefslogtreecommitdiffstats
path: root/log_manager.cpp
diff options
context:
space:
mode:
authorAdriana Kobylak <anoo@us.ibm.com>2017-01-22 14:56:04 -0600
committerAdriana Kobylak <anoo@us.ibm.com>2017-02-15 11:05:41 -0600
commitc5f0bbd99a4a01435585da977bec82634e45cc4b (patch)
tree57683f68e88b87524f0bccfc055be0e2d8ae93ab /log_manager.cpp
parent4ea7f312c508af64634a3e308b8641d39c581e37 (diff)
downloadphosphor-logging-c5f0bbd99a4a01435585da977bec82634e45cc4b.tar.gz
phosphor-logging-c5f0bbd99a4a01435585da977bec82634e45cc4b.zip
Populate Timestamp when error entry is committed
Populate the Entry Timestamp property which is described as the time when the error log entry is committed in milliseconds since 1970. Change-Id: Id47fb974cf8220975eef0cc226581d0603a798a9 Signed-off-by: Adriana Kobylak <anoo@us.ibm.com>
Diffstat (limited to 'log_manager.cpp')
-rw-r--r--log_manager.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/log_manager.cpp b/log_manager.cpp
index e9f11ec..ef1cae8 100644
--- a/log_manager.cpp
+++ b/log_manager.cpp
@@ -1,5 +1,6 @@
#include <fstream>
#include <iostream>
+#include <chrono>
#include <cstdio>
#include <string>
#include <vector>
@@ -110,12 +111,15 @@ void Manager::commit(uint64_t transactionId, std::string errMsg)
// Create error Entry dbus object
entryId++;
+ auto ms = std::chrono::duration_cast<std::chrono::milliseconds>(
+ std::chrono::system_clock::now().time_since_epoch()).count();
auto objPath = std::string(OBJ_ENTRY) + '/' +
- std::to_string(entryId);
+ std::to_string(entryId);
entries.insert(std::make_pair(entryId, std::make_unique<Entry>(
busLog,
objPath,
entryId,
+ ms, // Milliseconds since 1970
(Entry::Level)g_errLevelMap[errMsg],
std::move(errMsg),
std::move(additionalData))));
OpenPOWER on IntegriCloud