Error / Event Log Framework
Framework to create an error log entry based on information
from the journal log.
1. elog.yaml - User defined reason codes for error scenarios that
include description, priority level, and desired metadata fields.
2. elog_parser.py - Parser for the yaml file
3. elog-gen.hpp - Auto-generated file based created by the parser
that includes the error log structures. Including for now for ref.
4. elog.hpp - Error log template to create (log a journal log
entry with the predefined error log information).
Usage: elog<RC>(NAME(value), prev_entry<NAME>()...)
where RC - Reason code, NAME - metadata name
being logged to a journal entry, prev_entry - A Metadata entry that
has previously being logged to a journal entry.
Example:
log<level::DEBUG>(
msg("Info trace to log filename"),
entry(file_not_found::file_name::str, my_filename));
elog<file_not_found>(file_not_found::errnum(2),
file_not_found::file_path("/tmp/"),
prev_entry<file_not_found::file_name>());
Change-Id: Ic51cee80b58e341c071c366c5e2146fd6694012c
Signed-off-by: Adriana Kobylak <anoo@us.ibm.com>
Signed-off-by: Andrew Geissler <andrewg@us.ibm.com>
diff --git a/elog-gen.hpp b/elog-gen.hpp
new file mode 100644
index 0000000..52d8d9b
--- /dev/null
+++ b/elog-gen.hpp
@@ -0,0 +1,59 @@
+// this file was autogenerated. do not edit.
+#pragma once
+
+#include <tuple>
+#include <type_traits>
+#include "log.hpp"
+
+namespace phosphor
+{
+
+namespace logging
+{
+
+namespace _file_not_found
+{
+struct errnum
+{
+ static constexpr auto str = "ERRNO=%d";
+ using type = std::tuple<std::decay_t<decltype(str)>,int>;
+ explicit constexpr errnum(int a) : _entry(entry(str, a)) {};
+ type _entry;
+};
+
+struct file_path
+{
+ static constexpr auto str = "FILE_PATH=%s";
+ using type = std::tuple<std::decay_t<decltype(str)>,const char*>;
+ explicit constexpr file_path(const char *a) : _entry(entry(str,a)) {};
+ type _entry;
+};
+
+struct file_name
+{
+ static constexpr auto str = "FILE_NAME=%s";
+ using type = std::tuple<std::decay_t<decltype(str)>,const char*>;
+ explicit constexpr file_name(const char *a) : _entry(entry(str,a)) {};
+ type _entry;
+};
+
+} // namespace _file_not_found
+
+struct file_not_found
+{
+ static constexpr auto err_code = "xyz.openbmc_project.logging.FILE_NOT_FOUND_ERROR";
+ static constexpr auto err_msg = "A required file was not found";
+ static constexpr auto L = level::INFO;
+
+ using errnum = _file_not_found::errnum;
+ using file_path = _file_not_found::file_path;
+ using file_name = _file_not_found::file_name;
+
+ using metadata_types = std::tuple<errnum, file_path, file_name>;
+};
+
+
+
+} // namespace logging
+
+} // namespace phosphor