diff options
author | Adriana Kobylak <anoo@us.ibm.com> | 2017-02-20 11:58:03 -0600 |
---|---|---|
committer | Adriana Kobylak <anoo@us.ibm.com> | 2017-03-02 10:27:03 -0600 |
commit | 465aaeccc5c01a437b3a3b23a9566482af0c32b5 (patch) | |
tree | 40fc263f8436b21556e3d458a39fd1dc3f69b0f4 /logging_test.cpp | |
parent | 3773430c91e0849e1c2c71f0f73deb3e87562e8a (diff) | |
download | phosphor-logging-465aaeccc5c01a437b3a3b23a9566482af0c32b5.tar.gz phosphor-logging-465aaeccc5c01a437b3a3b23a9566482af0c32b5.zip |
Include namespaces in the phosphor-logging exception name
Currently the phosphor-logging exception name is for example
Device for an error file located in xyz/openbmc_project/Error/Callout/.
It should instead be named xyz.openbmc_project.Error.Callout.Device
following the naming structure of the sdbusplus++ tool
to differentiate it from other Device error exceptions.
With the full name, the namespaces can be determined, so there's no
need to pass the namespace parameter to the template that generates
the elog-errors.hpp. As with the name, follow the namespace
structure of the sdbusplus exception object.
Closes openbmc/phosphor-logging#2
Change-Id: I960d759d90aa18fd43211034ebd6009859113ee7
Signed-off-by: Adriana Kobylak <anoo@us.ibm.com>
Diffstat (limited to 'logging_test.cpp')
-rw-r--r-- | logging_test.cpp | 33 |
1 files changed, 16 insertions, 17 deletions
diff --git a/logging_test.cpp b/logging_test.cpp index 96d2a36..ad51823 100644 --- a/logging_test.cpp +++ b/logging_test.cpp @@ -74,27 +74,28 @@ int main() const char *test_string = "/tmp/test_string/"; try { - elog<example::xyz::openbmc_project::Example::TestErrorOne>( - example::xyz::openbmc_project::Example::TestErrorOne:: - ERRNUM(number), - example::xyz::openbmc_project::Example::TestErrorOne:: - FILE_PATH(test_string), - example::xyz::openbmc_project::Example::TestErrorOne:: - FILE_NAME("elog_test_3.txt"), - example::xyz::openbmc_project::Example::TestErrorTwo:: - DEV_ADDR(0xDEADDEAD), - example::xyz::openbmc_project::Example::TestErrorTwo:: - DEV_ID(100), - example::xyz::openbmc_project::Example::TestErrorTwo:: - DEV_NAME("test case 3")); + elog<example::xyz::openbmc_project::Example::Elog::Error::TestErrorOne>( + example::xyz::openbmc_project::Example::Elog::Error:: + TestErrorOne::ERRNUM(number), + example::xyz::openbmc_project::Example::Elog::Error:: + TestErrorOne::FILE_PATH(test_string), + example::xyz::openbmc_project::Example::Elog::Error:: + TestErrorOne::FILE_NAME("elog_test_3.txt"), + example::xyz::openbmc_project::Example::Elog::Error:: + TestErrorTwo::DEV_ADDR(0xDEADDEAD), + example::xyz::openbmc_project::Example::Elog::Error:: + TestErrorTwo::DEV_ID(100), + example::xyz::openbmc_project::Example::Elog::Error:: + TestErrorTwo::DEV_NAME("test case 3")); } - catch (elogException<example::xyz::openbmc_project::Example::TestErrorOne>& e) + catch (elogException<example::xyz::openbmc_project::Example::Elog::Error:: + TestErrorOne>& e) { std::cout << "elog exception caught: " << e.what() << std::endl; } // Reduce our error namespaces - using namespace example::xyz::openbmc_project::Example; + using namespace example::xyz::openbmc_project::Example::Elog::Error; // Now read back and verify our data made it into the journal std::stringstream stream; @@ -192,5 +193,3 @@ int main() return 0; } - - |