elog-lookup: include inherited metadata
Include inherited metadata in the code generated for metadata lookup.
Change-Id: I9389eb08b0c74c94a377f7434ee358965c2fdf2b
Signed-off-by: Deepak Kodihalli <dkodihal@in.ibm.com>
diff --git a/tools/phosphor-logging/templates/elog-lookup-template.mako.cpp b/tools/phosphor-logging/templates/elog-lookup-template.mako.cpp
index 4f1ce15..5e9e1ba 100644
--- a/tools/phosphor-logging/templates/elog-lookup-template.mako.cpp
+++ b/tools/phosphor-logging/templates/elog-lookup-template.mako.cpp
@@ -13,14 +13,23 @@
{
std::map<std::string,std::vector<std::string>> g_errMetaMap = {
- % for a in errors:
+ % for name in errors:
<%
meta_list = []
- if(a in meta):
- meta_list = meta[a]
+ if(name in meta):
+ meta_list = meta[name]
+ meta_string = '\",\"'.join(meta_list)
+
+ parent = parents[name]
+ while parent:
+ tmpparent = parent.split('.')
+ ## Name is the last item
+ parent_name = tmpparent[-1]
+ parent_meta_short = '\",\"'.join(meta[parent])
+ meta_string = meta_string + "\",\"" + parent_meta_short
+ parent = parents[parent]
%>\
- <% meta_string = '\",\"'.join(meta_list) %> \
- {"${a}",{"${meta_string}"}},
+ {"${name}",{"${meta_string}"}},
% endfor
};