diff options
author | Deepak Kodihalli <dkodihal@in.ibm.com> | 2017-01-16 04:00:07 -0600 |
---|---|---|
committer | Deepak Kodihalli <dkodihal@in.ibm.com> | 2017-01-21 02:13:59 -0600 |
commit | 9916119f0daad8bd5b3fbd926ada9a023949f311 (patch) | |
tree | 3969872cbc71767e5adad2a786fc4813ff91500d /tools | |
parent | d310378f4fcd7a7bcdfea81c0e7c93351b6f992f (diff) | |
download | phosphor-logging-9916119f0daad8bd5b3fbd926ada9a023949f311.tar.gz phosphor-logging-9916119f0daad8bd5b3fbd926ada9a023949f311.zip |
Fix types in error-logging YAML to match openbmc standards
Change-Id: If5e2e534740f0675ba9294905ae531e015aed85a
Signed-off-by: Deepak Kodihalli <dkodihal@in.ibm.com>
Diffstat (limited to 'tools')
-rwxr-xr-x | tools/elog-gen.py | 19 | ||||
-rw-r--r-- | tools/example/xyz/openbmc_project/Example/Elog.metadata.yaml | 12 | ||||
-rw-r--r-- | tools/phosphor-logging/templates/elog-gen-template.mako.hpp | 1 |
3 files changed, 24 insertions, 8 deletions
diff --git a/tools/elog-gen.py b/tools/elog-gen.py index 57d5050..c72aa98 100755 --- a/tools/elog-gen.py +++ b/tools/elog-gen.py @@ -19,6 +19,21 @@ import sys import os +def get_cpp_type(i_type): + typeMap = { + 'int16': 'int16_t', + 'int32': 'int32_t', + 'int64': 'int64_t', + 'uint16': 'uint16_t', + 'uint32': 'uint32_t', + 'uint64': 'uint64_t', + 'double': 'double', + # const char* aids usage of constexpr + 'string': 'const char*'} + + return typeMap[i_type] + + def gen_elog_hpp(i_rootdir, i_elog_yaml, i_elog_meta_yaml, i_input_mako, i_output_hpp): r""" @@ -66,7 +81,7 @@ def gen_elog_hpp(i_rootdir, i_elog_yaml, i_elog_meta_yaml, meta_data[str_short] = {} meta_data[str_short]['str'] = j['str'] meta_data[str_short]['str_short'] = str_short - meta_data[str_short]['type'] = j['type'] + meta_data[str_short]['type'] = get_cpp_type(j['type']) meta.append(tmp_meta) err_count += 1 @@ -83,7 +98,7 @@ def gen_elog_hpp(i_rootdir, i_elog_yaml, i_elog_meta_yaml, f = open(i_output_hpp, 'w') f.write(mytemplate.render(errors=errors, error_msg=error_msg, error_lvl=error_lvl, meta=meta, - meta_data=meta_data,elog_yaml=i_elog_yaml)) + meta_data=meta_data, elog_yaml=i_elog_yaml)) f.close() diff --git a/tools/example/xyz/openbmc_project/Example/Elog.metadata.yaml b/tools/example/xyz/openbmc_project/Example/Elog.metadata.yaml index 9ca4a4e..244127c 100644 --- a/tools/example/xyz/openbmc_project/Example/Elog.metadata.yaml +++ b/tools/example/xyz/openbmc_project/Example/Elog.metadata.yaml @@ -2,18 +2,18 @@ level: INFO meta: - str: "ERRNUM=0x%.4X" - type: int + type: uint16 - str: FILE_PATH=%s - type: const char* + type: string - str: FILE_NAME=%s - type: const char* + type: string - name: TestErrorTwo level: ERR meta: - str: DEV_ADDR=0x%.8X - type: int + type: uint32 - str: DEV_ID=%u - type: int + type: uint32 - str: DEV_NAME=%s - type: const char* + type: string diff --git a/tools/phosphor-logging/templates/elog-gen-template.mako.hpp b/tools/phosphor-logging/templates/elog-gen-template.mako.hpp index b9d3d5e..5c11c1b 100644 --- a/tools/phosphor-logging/templates/elog-gen-template.mako.hpp +++ b/tools/phosphor-logging/templates/elog-gen-template.mako.hpp @@ -4,6 +4,7 @@ // See elog-gen.py for more details #pragma once +#include <string> #include <tuple> #include <type_traits> #include "log.hpp" |