| 56 | |
| 57 | |
| 58 | const 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; |