MCPcopy Create free account
hub / github.com/OpenVPN/openvpn3-linux / GetJSON

Method GetJSON

src/log/journal-log-parse.cpp:58–124  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

56
57
58const Json::Value LogEntry::GetJSON() const
59{
60 Json::Value ret;
61 ret["TIMESTAMP"] = Json::Value::UInt64(realtime);
62 ret["TIMESTAMP_STRING"] = timestamp;
63 ret["PID"] = pid;
64
65 if (!sender.empty())
66 {
67 ret["O3_SENDER"] = sender;
68 }
69 if (!interface.empty())
70 {
71 ret["O3_INTERFACE"] = interface;
72 }
73 if (!method.empty())
74 {
75 ret["O3_METHOD"] = method;
76 }
77 if (!int_method.empty())
78 {
79 ret["O3_INTERNAL_METHOD"] = int_method;
80 }
81 if (!property.empty())
82 {
83 ret["O3_PROPERTY"] = property;
84 }
85 if (!object_path.empty())
86 {
87 ret["O3_OBJECT_PATH"] = object_path;
88 }
89 if (!logtag.empty())
90 {
91 ret["O3_LOGTAG"] = logtag;
92 }
93 if (!event.empty())
94 {
95 Json::Value logev;
96
97 logev["LOG_GROUP"] = (uint8_t)event.group;
98 if (LogGroup::UNDEFINED != event.group)
99 {
100 logev["LOG_GROUP_STRING"] = event.GetLogGroupStr();
101 }
102
103 logev["LOG_CATEGORY"] = (uint8_t)event.category;
104 if (LogCategory::UNDEFINED != event.category)
105 {
106 logev["LOG_CATEGORY_STRING"] = event.GetLogCategoryStr();
107 }
108
109 if (!event.session_token.empty())
110 {
111 logev["SESSION_TOKEN"] = event.session_token;
112 }
113
114 std::stringstream msg;
115 std::string line;

Callers 2

cmd_journalFunction · 0.80
mainFunction · 0.80

Calls 3

GetLogGroupStrMethod · 0.80
GetLogCategoryStrMethod · 0.80
emptyMethod · 0.45

Tested by 1

mainFunction · 0.64