blob: 659048c052d8fed5c00bbbebfe17fdf4f0538e28 [file] [log] [blame]
Ben Tynerb1ebfcb2020-05-08 18:52:48 -05001#pragma once
2
Ben Tyner1b1915e2020-10-23 15:13:38 -05003#include <util/ffdc_file.hpp>
4
Ben Tynerb1ebfcb2020-05-08 18:52:48 -05005#include <cstddef> // for size_t
6#include <map>
7#include <string>
Ben Tyner1b1915e2020-10-23 15:13:38 -05008#include <vector>
Ben Tynerb1ebfcb2020-05-08 18:52:48 -05009
10namespace attn
11{
12
13/** @brief Logging level types */
14enum level
15{
16 INFO
17};
18
19/** @brief Logging event types */
20enum class EventType
21{
22 Checkstop = 0,
23 Terminate = 1,
24 Vital = 2,
25 HwDiagsFail = 3,
26 AttentionFail = 4
27};
28
29/** @brief Maximum length of a single trace event message */
30static const size_t trace_msg_max_len = 255;
31
32/** @brief create trace message */
33template <level L>
34void trace(const char* i_message);
35
36/** @brief commit checkstop event to log */
37void eventCheckstop(std::map<std::string, std::string>& i_errors);
38
39/** @brief commit special attention TI event to log */
Ben Tyner40717722020-09-23 09:43:20 -050040void eventTerminate(std::map<std::string, std::string> i_additionalData);
Ben Tynerb1ebfcb2020-05-08 18:52:48 -050041
42/** @brief commit SBE vital event to log */
43void eventVital();
44
45/** @brief commit analyzer failure event to log */
46void eventHwDiagsFail(int i_error);
47
48/** @brief commit attention handler failure event to log */
49void eventAttentionFail(int i_error);
50
Ben Tyner1b1915e2020-10-23 15:13:38 -050051/**
52 * Create an FFDCFile object containing the specified lines of text data.
53 *
54 * Throws an exception if an error occurs.
55 *
56 * @param lines lines of text data to write to file
57 * @return FFDCFile object
58 */
59util::FFDCFile createFFDCFile(const std::vector<std::string>& lines);
60
61/**
62 * Create FFDCFile objects containing debug data to store in the error log.
63 *
64 * If an error occurs, the error is written to the journal but an exception
65 * is not thrown.
66 *
67 * @param journal system journal
68 * @return vector of FFDCFile objects
69 */
70std::vector<util::FFDCFile> createFFDCFiles();
71
Ben Tynerb1ebfcb2020-05-08 18:52:48 -050072} // namespace attn