blob: a1c1a59347cfa3e865e9f5a98836da88a72fbd15 [file] [log] [blame]
Matt Spinler8c686cc2019-09-20 13:46:02 -05001#pragma once
2
3#include "elog_entry.hpp"
Matt Spinler8b81ec02022-07-12 13:25:37 -05004#include "pel_types.hpp"
5
6#include <optional>
Matt Spinler8c686cc2019-09-20 13:46:02 -05007
8namespace openpower
9{
10namespace pels
11{
12
13/**
14 * @brief Convert an OpenBMC event log severity to a PEL severity
15 *
16 * @param[in] severity - The OpenBMC event log severity
17 *
18 * @return uint8_t - The PEL severity value
19 */
20uint8_t convertOBMCSeverityToPEL(phosphor::logging::Entry::Level severity);
21
Matt Spinler8b81ec02022-07-12 13:25:37 -050022/**
23 * @brief Possibly calculate a new LogSeverity value based on the
24 * current LogSeverity and PEL severity.
25 *
26 * Just handles cases where the LogSeverity value is clearly out of
27 * sync with the PEL severity:
28 * - critical PEL but non critical LogSeverity
29 * - info PEL but non info LogSeverity
30 * - non info PEL but info LogSeverity
31 *
32 * @param[in] obmcSeverity - The current LogSeverity
33 * @param[in] pelSeverity - The PEL severity
34 *
35 * @return optional<LogSeverity> The new LogSeverity to use if one was
36 * found, otherwise std::nullopt which means the original one
37 * is good enough.
38 */
39std::optional<phosphor::logging::Entry::Level>
40 fixupLogSeverity(phosphor::logging::Entry::Level obmcSeverity,
41 SeverityType pelSeverity);
Matt Spinler8c686cc2019-09-20 13:46:02 -050042} // namespace pels
43} // namespace openpower