Logger:error handling enhancements
This commit adds following enhancements in Logger:
- add a try-catch block in Logger::logMessage to catch exceptions
locally. In case of any exception log message is redirected to journal
so that it is not lost.
- Enable filestream exceptions before opening the filestream. This
ensures that an exception is thrown if there is any error while
opening the file.
Change-Id: I35df92c33ef0c15b9f440651e271f31dfa13d5b3
Signed-off-by: Souvik Roy <souvikroyofficial10@gmail.com>
diff --git a/vpd-manager/include/logger.hpp b/vpd-manager/include/logger.hpp
index ec63de7..78fee79 100644
--- a/vpd-manager/include/logger.hpp
+++ b/vpd-manager/include/logger.hpp
@@ -306,7 +306,7 @@
const PlaceHolder& i_placeHolder = PlaceHolder::DEFAULT,
const types::PelInfoTuple* i_pelTuple = nullptr,
const std::source_location& i_location =
- std::source_location::current());
+ std::source_location::current()) noexcept;
#ifdef ENABLE_FILE_LOGGING
/**