Add getStateSummary method for diagnostics

Summary:
Adds a more structured representation of state updates than a multiline string.
Also changes the string form to omit [started] records.

Reviewed By: danielbuechele

Differential Revision: D9315503

fbshipit-source-id: 55b8f9572091fd42fe852c8d26a8f2a53f76c82a
This commit is contained in:
John Knox
2018-08-15 05:06:34 -07:00
committed by Facebook Github Bot
parent e51b8c0742
commit 660da3f80e
10 changed files with 144 additions and 13 deletions

View File

@@ -12,6 +12,7 @@
#include "SonarState.h"
#include "SonarStep.h"
#include "SonarWebSocketImpl.h"
#include <vector>
#ifdef __ANDROID__
#include <android/log.h>
@@ -110,10 +111,8 @@ void SonarClient::refreshPlugins() {
void SonarClient::onConnected() {
SONAR_LOG("SonarClient::onConnected");
auto step = sonarState_->start("Connect");
std::lock_guard<std::mutex> lock(mutex_);
connected_ = true;
step->complete();
}
void SonarClient::onDisconnected() {
@@ -216,6 +215,10 @@ std::string SonarClient::getState() {
return sonarState_->getState();
}
std::vector<StateElement> SonarClient::getStateElements() {
return sonarState_->getStateElements();
}
} // namespace sonar
} // namespace facebook