summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xtools/elog-gen.py18
-rw-r--r--tools/phosphor-logging/templates/elog-process-metadata.mako.cpp24
2 files changed, 37 insertions, 5 deletions
diff --git a/tools/elog-gen.py b/tools/elog-gen.py
index 469248f..29ff52f 100755
--- a/tools/elog-gen.py
+++ b/tools/elog-gen.py
@@ -120,6 +120,7 @@ def gen_elog_hpp(i_yaml_dir, i_test_dir, i_output_hpp,
meta = dict() # The meta data names associated (ERRNO, FILE_NAME, ...)
meta_data = dict() # The meta data info (type, format)
parents = dict()
+ metadata_process = dict() # metadata that have the 'process' keyword set
error_yamls = get_error_yaml_files(i_yaml_dir, i_test_dir)
@@ -150,7 +151,8 @@ def gen_elog_hpp(i_yaml_dir, i_test_dir, i_output_hpp,
error_lvl,
meta,
meta_data,
- parents))
+ parents,
+ metadata_process))
if(not check_error_inheritance(errors, parents)):
print("Error - failed to validate error inheritance")
@@ -164,10 +166,13 @@ def gen_elog_hpp(i_yaml_dir, i_test_dir, i_output_hpp,
template = Template(filename=template_path)
f = open(i_output_hpp, 'w')
f.write(template.render(
- errors=errors, error_msg=error_msg,
- error_lvl=error_lvl, meta=meta,
+ errors=errors,
+ error_msg=error_msg,
+ error_lvl=error_lvl,
+ meta=meta,
meta_data=meta_data,
- parents=parents))
+ parents=parents,
+ metadata_process=metadata_process))
f.close()
@@ -185,7 +190,8 @@ def get_elog_data(i_elog_yaml,
i_namespace namespace data
o_elog_data error metadata
"""
- errors, error_msg, error_lvl, meta, meta_data, parents = o_elog_data
+ (errors, error_msg, error_lvl, meta,
+ meta_data, parents, metadata_process) = o_elog_data
ifile = yaml.safe_load(open(i_elog_yaml))
mfile = yaml.safe_load(open(i_elog_meta_yaml))
for i in mfile:
@@ -222,6 +228,8 @@ def get_elog_data(i_elog_yaml,
meta_data[str_short]['str'] = j['str']
meta_data[str_short]['str_short'] = str_short
meta_data[str_short]['type'] = get_cpp_type(j['type'])
+ if(('process' in j) and (True == j['process'])):
+ metadata_process[str_short] = fullname + "." + str_short
meta[fullname] = tmp_meta
# Debug
diff --git a/tools/phosphor-logging/templates/elog-process-metadata.mako.cpp b/tools/phosphor-logging/templates/elog-process-metadata.mako.cpp
new file mode 100644
index 0000000..267413d
--- /dev/null
+++ b/tools/phosphor-logging/templates/elog-process-metadata.mako.cpp
@@ -0,0 +1,24 @@
+## Note that this file is not auto generated, it is what generates the
+## elog-metadata-postprocess.cpp file
+// This file was autogenerated. Do not edit!
+// See elog-gen.py for more details
+
+#include <string>
+#include <vector>
+#include <functional>
+#include <phosphor-logging/elog-errors.hpp>
+#include "elog_meta.hpp"
+
+using namespace phosphor::logging;
+using namespace example::xyz::openbmc_project::Example::Elog;
+using namespace std::placeholders;
+
+extern const std::map<metadata::Metadata,
+ std::function<metadata::associations::Type>> meta = {
+ % for key, value in metadata_process.iteritems():
+<%
+ type = value.replace(".", "::")
+%>\
+ {"${key}", metadata::associations::build<${type}>},
+ % endfor
+};
OpenPOWER on IntegriCloud