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 /tools/phosphor-logging | |
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 'tools/phosphor-logging')
-rw-r--r-- | tools/phosphor-logging/templates/elog-gen-template.mako.hpp | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/tools/phosphor-logging/templates/elog-gen-template.mako.hpp b/tools/phosphor-logging/templates/elog-gen-template.mako.hpp index 097b865..181d4bd 100644 --- a/tools/phosphor-logging/templates/elog-gen-template.mako.hpp +++ b/tools/phosphor-logging/templates/elog-gen-template.mako.hpp @@ -17,17 +17,19 @@ namespace logging % for index, name in enumerate(errors): <% - namespaces = error_namespace[name].split('/') - ## In case someone provided a error_namespace ending with '/', remove the - ## last split string, which would be an empty string. - if not namespaces[-1]: - namespaces = namespaces[:-1] - classname = name + ## Ex: name: xyz.openbmc_project.Error.Callout.Device + namespaces = name.split('.') + ## classname is the last name item (Device) + classname = namespaces[-1] + ## namespaces are all the name items except the last one + namespaces = namespaces[:-1] %>\ % for s in namespaces: namespace ${s} { % endfor +namespace Error +{ namespace _${classname} { % for b in meta[name]: @@ -48,7 +50,13 @@ struct ${b} parent = parents[name] while parent: - parent_meta += [parent + "::" + p for p in meta[parent]] + tmpparent = parent.split('.') + ## Name is the last item + parent_name = tmpparent[-1] + ## namespaces are all the name items except the last one + parent_namespace = '::'.join(tmpparent[:-1]) + parent_meta += [parent_namespace + "::Error::" + parent_name + "::" + + p for p in meta[parent]] parent_meta_short = ', '.join(meta[parent]) meta_string = meta_string + ", " + parent_meta_short parent = parents[parent] @@ -66,6 +74,8 @@ struct ${classname} % endfor using metadata_types = std::tuple<${meta_string}>; }; + +} // namespace Error % for s in reversed(namespaces): } // namespace ${s} % endfor |