FlipperClient log format
Summary: Use the same standard used in other places. Reviewed By: ivanmisuno Differential Revision: D49228128 fbshipit-source-id: 771b6923f758400200298f3339b83b2c4d51648b
This commit is contained in:
committed by
Facebook GitHub Bot
parent
7f355dd19d
commit
54f5b1ba03
@@ -50,20 +50,20 @@ FlipperClient* FlipperClient::instance() {
|
|||||||
void FlipperClient::setStateListener(
|
void FlipperClient::setStateListener(
|
||||||
std::shared_ptr<FlipperStateUpdateListener> stateListener) {
|
std::shared_ptr<FlipperStateUpdateListener> stateListener) {
|
||||||
performAndReportError([this, &stateListener]() {
|
performAndReportError([this, &stateListener]() {
|
||||||
log("Setting state listener");
|
log("[client] Set state listener");
|
||||||
flipperState_->setUpdateListener(stateListener);
|
flipperState_->setUpdateListener(stateListener);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void FlipperClient::addPlugin(std::shared_ptr<FlipperPlugin> plugin) {
|
void FlipperClient::addPlugin(std::shared_ptr<FlipperPlugin> plugin) {
|
||||||
performAndReportError([this, plugin]() {
|
performAndReportError([this, plugin]() {
|
||||||
log("FlipperClient::addPlugin " + plugin->identifier());
|
log("[client] Add plugin " + plugin->identifier());
|
||||||
auto step = flipperState_->start("Add plugin " + plugin->identifier());
|
auto step = flipperState_->start("Add plugin " + plugin->identifier());
|
||||||
auto needs_refresh = false;
|
auto needs_refresh = false;
|
||||||
|
|
||||||
std::lock_guard<std::mutex> lock(mutex_);
|
std::lock_guard<std::mutex> lock(mutex_);
|
||||||
if (plugins_.find(plugin->identifier()) != plugins_.end()) {
|
if (plugins_.find(plugin->identifier()) != plugins_.end()) {
|
||||||
log("plugin " + plugin->identifier() + " already added.");
|
log("[client] Plugin " + plugin->identifier() + " already added");
|
||||||
} else {
|
} else {
|
||||||
plugins_[plugin->identifier()] = plugin;
|
plugins_[plugin->identifier()] = plugin;
|
||||||
needs_refresh = true;
|
needs_refresh = true;
|
||||||
@@ -78,7 +78,6 @@ void FlipperClient::addPlugin(std::shared_ptr<FlipperPlugin> plugin) {
|
|||||||
void FlipperClient::setCertificateProvider(
|
void FlipperClient::setCertificateProvider(
|
||||||
const std::shared_ptr<FlipperCertificateProvider> provider) {
|
const std::shared_ptr<FlipperCertificateProvider> provider) {
|
||||||
socket_->setCertificateProvider(provider);
|
socket_->setCertificateProvider(provider);
|
||||||
log("cpp setCertificateProvider called");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
std::shared_ptr<FlipperCertificateProvider>
|
std::shared_ptr<FlipperCertificateProvider>
|
||||||
@@ -88,11 +87,11 @@ FlipperClient::getCertificateProvider() {
|
|||||||
|
|
||||||
void FlipperClient::removePlugin(std::shared_ptr<FlipperPlugin> plugin) {
|
void FlipperClient::removePlugin(std::shared_ptr<FlipperPlugin> plugin) {
|
||||||
performAndReportError([this, plugin]() {
|
performAndReportError([this, plugin]() {
|
||||||
log("FlipperClient::removePlugin " + plugin->identifier());
|
log("[client] Remove plugin: " + plugin->identifier());
|
||||||
|
|
||||||
std::lock_guard<std::mutex> lock(mutex_);
|
std::lock_guard<std::mutex> lock(mutex_);
|
||||||
if (plugins_.find(plugin->identifier()) == plugins_.end()) {
|
if (plugins_.find(plugin->identifier()) == plugins_.end()) {
|
||||||
log("plugin " + plugin->identifier() + " not added.");
|
log("[client] Plugin " + plugin->identifier() + " not added");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
disconnect(plugin);
|
disconnect(plugin);
|
||||||
@@ -143,7 +142,7 @@ void FlipperClient::refreshPlugins() {
|
|||||||
|
|
||||||
void FlipperClient::onConnected() {
|
void FlipperClient::onConnected() {
|
||||||
performAndReportError([this]() {
|
performAndReportError([this]() {
|
||||||
log("FlipperClient::onConnected");
|
log("[client] connected");
|
||||||
|
|
||||||
std::lock_guard<std::mutex> lock(mutex_);
|
std::lock_guard<std::mutex> lock(mutex_);
|
||||||
connected_ = true;
|
connected_ = true;
|
||||||
@@ -152,7 +151,7 @@ void FlipperClient::onConnected() {
|
|||||||
|
|
||||||
void FlipperClient::onDisconnected() {
|
void FlipperClient::onDisconnected() {
|
||||||
performAndReportError([this]() {
|
performAndReportError([this]() {
|
||||||
log("FlipperClient::onDisconnected");
|
log("[client] disconnected");
|
||||||
auto step = flipperState_->start("Trigger onDisconnected callbacks");
|
auto step = flipperState_->start("Trigger onDisconnected callbacks");
|
||||||
std::lock_guard<std::mutex> lock(mutex_);
|
std::lock_guard<std::mutex> lock(mutex_);
|
||||||
connected_ = false;
|
connected_ = false;
|
||||||
@@ -280,7 +279,7 @@ void FlipperClient::onMessageReceived(
|
|||||||
"stacktrace", callstack())("name", e.what()));
|
"stacktrace", callstack())("name", e.what()));
|
||||||
}
|
}
|
||||||
} catch (...) {
|
} catch (...) {
|
||||||
log("Unknown error suppressed in FlipperClient");
|
log("[client] Unknown error suppressed");
|
||||||
if (responder) {
|
if (responder) {
|
||||||
responder->error(dynamic::object(
|
responder->error(dynamic::object(
|
||||||
"message",
|
"message",
|
||||||
@@ -333,7 +332,7 @@ void FlipperClient::performAndReportError(const std::function<void()>& func) {
|
|||||||
} catch (...) {
|
} catch (...) {
|
||||||
// Generic catch block for the exception of type not belonging to
|
// Generic catch block for the exception of type not belonging to
|
||||||
// std::exception
|
// std::exception
|
||||||
log("Unknown error suppressed in FlipperClient");
|
log("[client] Unknown error suppressed");
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@@ -347,7 +346,7 @@ void FlipperClient::handleError(std::exception& e) {
|
|||||||
"name", e.what()));
|
"name", e.what()));
|
||||||
socket_->sendMessage(message);
|
socket_->sendMessage(message);
|
||||||
} else {
|
} else {
|
||||||
log("Error: " + std::string(e.what()));
|
log("[client] Error: " + std::string(e.what()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user