| 59 | } |
| 60 | |
| 61 | void DaemonClient::sendLog(LogType logType, const std::string& message) { |
| 62 | Value log; |
| 63 | switch (logType) { |
| 64 | case LogTypeDebug: |
| 65 | log.setMapValue("severity", Value(STRING_LITERAL("debug"))); |
| 66 | break; |
| 67 | case LogTypeInfo: |
| 68 | log.setMapValue("severity", Value(STRING_LITERAL("info"))); |
| 69 | break; |
| 70 | case LogTypeWarn: |
| 71 | log.setMapValue("severity", Value(STRING_LITERAL("warn"))); |
| 72 | break; |
| 73 | case LogTypeError: |
| 74 | log.setMapValue("severity", Value(STRING_LITERAL("error"))); |
| 75 | break; |
| 76 | case LogTypeCount: |
| 77 | break; |
| 78 | } |
| 79 | log.setMapValue("log", Value(message)); |
| 80 | auto logs = ValueArray::make(1); |
| 81 | logs->emplace(0, log); |
| 82 | Value newLogs; |
| 83 | newLogs.setMapValue("new_logs", Value(logs)); |
| 84 | Value json; |
| 85 | json.setMapValue("event", newLogs); |
| 86 | submitPayload(json); |
| 87 | } |
| 88 | |
| 89 | void DaemonClient::submitRequest(const Value& payload, const Ref<ValueFunction>& callback) { |
| 90 | submitRequest(payload, [=](const Value& response) { |