Update elog gen script to support the dbus specified errors
This work is in prep for running this python script against the
errors defined in the phosphor-dbus-interfaces repo
Change-Id: I85e6f612a5935391deaedc74aab06ca023c15703
Signed-off-by: Andrew Geissler <andrewg@us.ibm.com>
diff --git a/elog-gen-template.mako.hpp b/elog-gen-template.mako.hpp
index 8461f70..cb7137d 100644
--- a/elog-gen-template.mako.hpp
+++ b/elog-gen-template.mako.hpp
@@ -15,7 +15,16 @@
{
% for a in errors:
-namespace _${errors[a]}
+<%
+ namespaces = errors[a].split('.')
+ classname = namespaces.pop()
+%>\
+ % for s in namespaces:
+namespace ${s}
+{
+ % endfor
+
+namespace _${classname}
{
% for b in meta[a]:
struct ${b}
@@ -28,19 +37,23 @@
};
% endfor
-} // namespace _${errors[a]}
+} // namespace _${classname}
<% meta_string = ', '.join(meta[a]) %>
-struct ${errors[a]}
+struct ${classname}
{
- static constexpr auto err_code = "xyz.openbmc_project.logging.${errors[a]}";
+ static constexpr auto err_code = "${errors[a]}";
static constexpr auto err_msg = "${error_msg[errors[a]]}";
static constexpr auto L = level::${error_lvl[errors[a]]};
% for b in meta[a]:
- using ${b} = _${errors[a]}::${b};
+ using ${b} = _${classname}::${b};
% endfor
using metadata_types = std::tuple<${meta_string}>;
};
+% for s in reversed(namespaces):
+} // namespace ${s}
+% endfor
+
% endfor
} // namespace logging