From 54f5b1ba03ee682d2bd70ed439672e082913272b Mon Sep 17 00:00:00 2001 From: Lorenzo Blasa Date: Tue, 19 Sep 2023 07:01:41 -0700 Subject: [PATCH] FlipperClient log format Summary: Use the same standard used in other places. Reviewed By: ivanmisuno Differential Revision: D49228128 fbshipit-source-id: 771b6923f758400200298f3339b83b2c4d51648b --- xplat/Flipper/FlipperClient.cpp | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/xplat/Flipper/FlipperClient.cpp b/xplat/Flipper/FlipperClient.cpp index a317657461a..09137fd83d9 100644 --- a/xplat/Flipper/FlipperClient.cpp +++ b/xplat/Flipper/FlipperClient.cpp @@ -50,20 +50,20 @@ FlipperClient* FlipperClient::instance() { void FlipperClient::setStateListener( std::shared_ptr stateListener) { performAndReportError([this, &stateListener]() { - log("Setting state listener"); + log("[client] Set state listener"); flipperState_->setUpdateListener(stateListener); }); } void FlipperClient::addPlugin(std::shared_ptr plugin) { performAndReportError([this, plugin]() { - log("FlipperClient::addPlugin " + plugin->identifier()); + log("[client] Add plugin " + plugin->identifier()); auto step = flipperState_->start("Add plugin " + plugin->identifier()); auto needs_refresh = false; std::lock_guard lock(mutex_); if (plugins_.find(plugin->identifier()) != plugins_.end()) { - log("plugin " + plugin->identifier() + " already added."); + log("[client] Plugin " + plugin->identifier() + " already added"); } else { plugins_[plugin->identifier()] = plugin; needs_refresh = true; @@ -78,7 +78,6 @@ void FlipperClient::addPlugin(std::shared_ptr plugin) { void FlipperClient::setCertificateProvider( const std::shared_ptr provider) { socket_->setCertificateProvider(provider); - log("cpp setCertificateProvider called"); } std::shared_ptr @@ -88,11 +87,11 @@ FlipperClient::getCertificateProvider() { void FlipperClient::removePlugin(std::shared_ptr plugin) { performAndReportError([this, plugin]() { - log("FlipperClient::removePlugin " + plugin->identifier()); + log("[client] Remove plugin: " + plugin->identifier()); std::lock_guard lock(mutex_); if (plugins_.find(plugin->identifier()) == plugins_.end()) { - log("plugin " + plugin->identifier() + " not added."); + log("[client] Plugin " + plugin->identifier() + " not added"); return; } disconnect(plugin); @@ -143,7 +142,7 @@ void FlipperClient::refreshPlugins() { void FlipperClient::onConnected() { performAndReportError([this]() { - log("FlipperClient::onConnected"); + log("[client] connected"); std::lock_guard lock(mutex_); connected_ = true; @@ -152,7 +151,7 @@ void FlipperClient::onConnected() { void FlipperClient::onDisconnected() { performAndReportError([this]() { - log("FlipperClient::onDisconnected"); + log("[client] disconnected"); auto step = flipperState_->start("Trigger onDisconnected callbacks"); std::lock_guard lock(mutex_); connected_ = false; @@ -280,7 +279,7 @@ void FlipperClient::onMessageReceived( "stacktrace", callstack())("name", e.what())); } } catch (...) { - log("Unknown error suppressed in FlipperClient"); + log("[client] Unknown error suppressed"); if (responder) { responder->error(dynamic::object( "message", @@ -333,7 +332,7 @@ void FlipperClient::performAndReportError(const std::function& func) { } catch (...) { // Generic catch block for the exception of type not belonging to // std::exception - log("Unknown error suppressed in FlipperClient"); + log("[client] Unknown error suppressed"); } #endif } @@ -347,7 +346,7 @@ void FlipperClient::handleError(std::exception& e) { "name", e.what())); socket_->sendMessage(message); } else { - log("Error: " + std::string(e.what())); + log("[client] Error: " + std::string(e.what())); } }