src/fw-logs/fw-log-data.cpp
Go to the documentation of this file.
1 // License: Apache 2.0. See LICENSE file in root directory.
2 // Copyright(c) 2019 Intel Corporation. All Rights Reserved.
3 #include "fw-log-data.h"
4 #include <sstream>
5 #include <iomanip>
6 #include <locale>
7 #include <string>
8 
9 using namespace std;
10 
11 # define SET_WIDTH_AND_FILL(num, element) \
12 setfill(' ') << setw(num) << left << element \
13 
14 namespace librealsense
15 {
16  namespace fw_logs
17  {
18  fw_log_data::fw_log_data(void)
19  {
20  _magic_number = 0;
21  _severity = 0;
22  _file_id = 0;
23  _group_id = 0;
24  _event_id = 0;
25  _line = 0;
26  _sequence = 0;
27  _p1 = 0;
28  _p2 = 0;
29  _p3 = 0;
30  _timestamp = 0;
31  _delta = 0;
32  _message = "";
33  _file_name = "";
34  }
35 
36 
37  fw_log_data::~fw_log_data(void)
38  {
39  }
40 
41 
42  rs2_log_severity fw_log_data::get_severity() const
43  {
44  return fw_logs_severity_to_log_severity(_severity);
45  }
46 
47  const std::string& fw_log_data::get_message() const
48  {
49  return _message;
50  }
51 
53  {
54  return _file_name;
55  }
56 
57  const std::string& fw_log_data::get_thread_name() const
58  {
59  return _thread_name;
60  }
61 
62  uint32_t fw_log_data::get_line() const
63  {
64  return _line;
65  }
66 
67  uint32_t fw_log_data::get_timestamp() const
68  {
69  return (uint32_t)_timestamp;
70  }
71 
72  uint32_t fw_log_data::get_sequence_id() const
73  {
74  return _sequence;
75  }
76 
77  rs2_log_severity fw_logs_binary_data::get_severity() const
78  {
79  const fw_log_binary* log_binary = reinterpret_cast<const fw_log_binary*>(logs_buffer.data());
80  return fw_logs_severity_to_log_severity(static_cast<int32_t>(log_binary->dword1.bits.severity));
81  }
82 
83  uint32_t fw_logs_binary_data::get_timestamp() const
84  {
85  const fw_log_binary* log_binary = reinterpret_cast<const fw_log_binary*>(logs_buffer.data());
86  return static_cast<uint32_t>(log_binary->dword5.timestamp);
87  }
88 
90  {
92  switch (severity)
93  {
94  case 1:
95  result = RS2_LOG_SEVERITY_DEBUG;
96  break;
97  case 2:
98  result = RS2_LOG_SEVERITY_WARN;
99  break;
100  case 3:
101  result = RS2_LOG_SEVERITY_ERROR;
102  break;
103  case 4:
104  result = RS2_LOG_SEVERITY_FATAL;
105  break;
106  default:
107  break;
108  }
109  return result;
110  }
111  }
112 }
GLenum GLuint GLenum severity
GLsizei const GLchar *const * string
struct librealsense::fw_logs::fw_log_header_dword1::@2 bits
unsigned int uint32_t
Definition: stdint.h:80
std::string get_file_name(const std::string &path)
Definition: os.cpp:224
rs2_log_severity fw_logs_severity_to_log_severity(int32_t severity)
signed int int32_t
Definition: stdint.h:77
rs2_log_severity
Severity of the librealsense logger.
Definition: rs_types.h:153
GLuint64EXT * result
Definition: glext.h:10921


librealsense2
Author(s): Sergey Dorodnicov , Doron Hirshberg , Mark Horn , Reagan Lopez , Itay Carpis
autogenerated on Mon May 3 2021 02:47:15