forked from IntelRealSense/librealsense
-
Notifications
You must be signed in to change notification settings - Fork 0
/
fw-log-data.cpp
57 lines (48 loc) · 1.27 KB
/
fw-log-data.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
// License: Apache 2.0. See LICENSE file in root directory.
// Copyright(c) 2019 Intel Corporation. All Rights Reserved.
#include "fw-log-data.h"
#include <sstream>
#include <iomanip>
#include <locale>
#include <string>
using namespace std;
# define SET_WIDTH_AND_FILL(num, element) \
setfill(' ') << setw(num) << left << element \
namespace fw_logger
{
fw_log_data::fw_log_data(void)
{
magic_number = 0;
severity = 0;
file_id = 0;
group_id = 0;
event_id = 0;
line = 0;
sequence = 0;
p1 = 0;
p2 = 0;
p3 = 0;
timestamp = 0;
delta = 0;
message = "";
file_name = "";
}
fw_log_data::~fw_log_data(void)
{
}
string fw_log_data::to_string()
{
stringstream fmt;
fmt << SET_WIDTH_AND_FILL(6, sequence)
<< SET_WIDTH_AND_FILL(30, file_name)
<< SET_WIDTH_AND_FILL(6, group_id)
<< SET_WIDTH_AND_FILL(15, thread_name)
<< SET_WIDTH_AND_FILL(6, severity)
<< SET_WIDTH_AND_FILL(6, line)
<< SET_WIDTH_AND_FILL(15, timestamp)
<< SET_WIDTH_AND_FILL(15, delta)
<< SET_WIDTH_AND_FILL(30, message);
auto str = fmt.str();
return str;
}
}