blob: 818eb0f0c2665df6ae9af20ca256b90cbf5a7db8 [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 */
Patrick Williams075c7922024-08-16 15:19:49 -040039std::optional<phosphor::logging::Entry::Level> fixupLogSeverity(
40 phosphor::logging::Entry::Level obmcSeverity, SeverityType pelSeverity);
Matt Spinler8c686cc2019-09-20 13:46:02 -050041} // namespace pels
42} // namespace openpower