From 24d4ade4b30b7c244b5d95947c48a9b2fe4fac6b Mon Sep 17 00:00:00 2001 From: Nick Bourdakos Date: Tue, 19 Nov 2024 13:33:43 -0800 Subject: [PATCH] Replace `NEARBY_LOGS(VERBOSE)` with `VLOG(1)` PiperOrigin-RevId: 698128025 --- .../fast_pair_data_encryptor_impl.cc | 4 +-- .../fast_pair_gatt_service_client_impl.cc | 10 +++--- fastpair/internal/fast_pair_seeker_impl.cc | 18 +++++----- fastpair/internal/mediums/ble_v2.cc | 2 +- .../internal/mediums/bluetooth_classic.cc | 2 +- fastpair/internal/mediums/bluetooth_radio.cc | 4 +-- .../internal/mediums/robust_gatt_client.cc | 2 +- fastpair/message_stream/fake_provider.cc | 35 ++++++++----------- .../pairing/fastpair/fast_pair_pairer_impl.cc | 4 +-- fastpair/plugins/windows_admin_plugin.cc | 2 +- fastpair/proto/proto_builder.cc | 2 +- .../repository/fast_pair_device_repository.cc | 2 +- .../repository/fast_pair_repository_impl.cc | 2 +- .../retroactive_pairing_detector_impl.cc | 4 +-- .../fast_pair_discoverable_scanner.cc | 2 +- .../fast_pair_non_discoverable_scanner.cc | 2 +- .../fastpair/fast_pair_scanner_impl.cc | 10 +++--- fastpair/scanning/scanner_broker_impl.cc | 4 +-- .../server_access/fast_pair_client_impl.cc | 12 +++---- .../server_access/fast_pair_http_notifier.cc | 14 ++++---- fastpair/ui/ui_broker_impl.cc | 4 +-- 21 files changed, 68 insertions(+), 73 deletions(-) diff --git a/fastpair/handshake/fast_pair_data_encryptor_impl.cc b/fastpair/handshake/fast_pair_data_encryptor_impl.cc index 1d20a59366..df54887149 100644 --- a/fastpair/handshake/fast_pair_data_encryptor_impl.cc +++ b/fastpair/handshake/fast_pair_data_encryptor_impl.cc @@ -48,7 +48,7 @@ FastPairDataEncryptorImpl::Factory* g_test_factory_ = nullptr; bool ValidateInputSize(const std::vector& encrypted_bytes) { if (encrypted_bytes.size() != kAesBlockByteSize) { - NEARBY_LOGS(VERBOSE) << __func__ << ": Encrypted bytes should have size = " + VLOG(1) << __func__ << ": Encrypted bytes should have size = " << kAesBlockByteSize << ", actual = " << encrypted_bytes.size(); return false; @@ -88,7 +88,7 @@ void FastPairDataEncryptorImpl::Factory::CreateAsyncWithKeyExchange( const FastPairDevice& device, absl::AnyInvocable)> on_get_instance_callback) { - NEARBY_LOGS(VERBOSE) << __func__; + VLOG(1) << __func__; auto& metadata = device.GetMetadata(); DCHECK(metadata); std::optional key_pair = diff --git a/fastpair/handshake/fast_pair_gatt_service_client_impl.cc b/fastpair/handshake/fast_pair_gatt_service_client_impl.cc index 9ca2c66aaa..c2a1bf5b3e 100644 --- a/fastpair/handshake/fast_pair_gatt_service_client_impl.cc +++ b/fastpair/handshake/fast_pair_gatt_service_client_impl.cc @@ -343,12 +343,12 @@ void FastPairGattServiceClientImpl::WriteAccountKey( void FastPairGattServiceClientImpl::NotifyInitializedError( PairFailure failure) { - NEARBY_LOGS(VERBOSE) << __func__ << failure; + VLOG(1) << __func__ << failure; ClearCurrentState(); executor_->Execute("init-error", [this, failure]() { if (on_gatt_initialized_callback_) { - NEARBY_LOGS(VERBOSE) << __func__ << "Executing initialized callback"; + VLOG(1) << __func__ << "Executing initialized callback"; std::move(on_gatt_initialized_callback_)(failure); } }); @@ -356,7 +356,7 @@ void FastPairGattServiceClientImpl::NotifyInitializedError( void FastPairGattServiceClientImpl::NotifyWriteRequestResult( absl::string_view value, std::optional failure) { - NEARBY_LOGS(VERBOSE) << __func__; + VLOG(1) << __func__; executor_->Execute( "key-based-response", [this, value = std::string(value), failure]() { if (key_based_write_response_callback_) { @@ -367,7 +367,7 @@ void FastPairGattServiceClientImpl::NotifyWriteRequestResult( void FastPairGattServiceClientImpl::NotifyWritePasskeyResult( absl::string_view value, std::optional failure) { - NEARBY_LOGS(VERBOSE) << __func__; + VLOG(1) << __func__; executor_->Execute( "passkey-response", [this, value = std::string(value), failure]() { if (passkey_write_response_callback_) { @@ -378,7 +378,7 @@ void FastPairGattServiceClientImpl::NotifyWritePasskeyResult( void FastPairGattServiceClientImpl::NotifyWriteAccountKeyResult( std::optional account_key, std::optional failure) { - NEARBY_LOGS(VERBOSE) << __func__; + VLOG(1) << __func__; executor_->Execute("passkey-response", [this, account_key, failure]() { if (account_key_write_callback_) { std::move(account_key_write_callback_)(account_key, failure); diff --git a/fastpair/internal/fast_pair_seeker_impl.cc b/fastpair/internal/fast_pair_seeker_impl.cc index 30b27f9526..592decb2cd 100644 --- a/fastpair/internal/fast_pair_seeker_impl.cc +++ b/fastpair/internal/fast_pair_seeker_impl.cc @@ -258,7 +258,7 @@ void FastPairSeekerImpl::InvalidateScanningState() { // Stop scanning when screen is off. if (is_screen_locked_) { absl::Status status = StopFastPairScan(); - NEARBY_LOGS(VERBOSE) << __func__ + VLOG(1) << __func__ << ": Stopping scanning because the screen is locked."; return; } @@ -271,22 +271,22 @@ void FastPairSeekerImpl::InvalidateScanningState() { } void FastPairSeekerImpl::DeviceAdded(BluetoothDevice& device) { - NEARBY_LOGS(VERBOSE) << __func__ << "(" << device.GetMacAddress() << ")"; + VLOG(1) << __func__ << "(" << device.GetMacAddress() << ")"; } void FastPairSeekerImpl::DeviceRemoved(BluetoothDevice& device) { - NEARBY_LOGS(VERBOSE) << __func__ << "(" << device.GetMacAddress() << ")"; + VLOG(1) << __func__ << "(" << device.GetMacAddress() << ")"; } void FastPairSeekerImpl::DeviceAddressChanged(BluetoothDevice& device, absl::string_view old_address) { - NEARBY_LOGS(VERBOSE) << __func__ << "(" << device.GetMacAddress() << ", " + VLOG(1) << __func__ << "(" << device.GetMacAddress() << ", " << old_address << ")"; } void FastPairSeekerImpl::DevicePairedChanged(BluetoothDevice& device, bool new_paired_status) { - NEARBY_LOGS(VERBOSE) << __func__ << "(" << device.GetMacAddress() << ", " + VLOG(1) << __func__ << "(" << device.GetMacAddress() << ", " << new_paired_status << ")"; // Note, the FP service will be notified about paired events from the // retroactive pairing path if `device` is an FP device. @@ -296,18 +296,18 @@ void FastPairSeekerImpl::DevicePairedChanged(BluetoothDevice& device, void FastPairSeekerImpl::DeviceConnectedStateChanged(BluetoothDevice& device, bool connected) { - NEARBY_LOGS(VERBOSE) << __func__ << "(" << device.GetMacAddress() << ", " + VLOG(1) << __func__ << "(" << device.GetMacAddress() << ", " << connected << ")"; } void FastPairSeekerImpl::OnRetroactivePairFound(FastPairDevice& device) { - NEARBY_LOGS(VERBOSE) << __func__ << ": " << device; + VLOG(1) << __func__ << ": " << device; callbacks_.on_pair_event(device, PairEvent{.is_paired = true}); } void FastPairSeekerImpl::ForgetDeviceByAccountKey( const AccountKey& account_key) { - NEARBY_LOGS(VERBOSE) << __func__; + VLOG(1) << __func__; auto opt_device = devices_->FindDevice(account_key); if (!opt_device.has_value()) { NEARBY_LOGS(INFO) << __func__ << "No FP device matching the account key."; @@ -318,7 +318,7 @@ void FastPairSeekerImpl::ForgetDeviceByAccountKey( repository_->DeleteAssociatedDeviceByAccountKey( account_key, [&](absl::Status success) { if (!success.ok()) return; - NEARBY_LOGS(VERBOSE) << "Deleted associated devcie by account key"; + VLOG(1) << "Deleted associated devcie by account key"; // Temporary solution to refresh the saved_devices_sheet. repository_->GetUserSavedDevices(); }); diff --git a/fastpair/internal/mediums/ble_v2.cc b/fastpair/internal/mediums/ble_v2.cc index 2147d6d161..fb990fc9d4 100644 --- a/fastpair/internal/mediums/ble_v2.cc +++ b/fastpair/internal/mediums/ble_v2.cc @@ -44,7 +44,7 @@ std::unique_ptr BleV2::ConnectToGattServer( return nullptr; } if (!IsAvailableLocked()) { - NEARBY_LOGS(VERBOSE) + VLOG(1) << __func__ << "Can't connect to GattServer because BleV2 isn't available."; return nullptr; diff --git a/fastpair/internal/mediums/bluetooth_classic.cc b/fastpair/internal/mediums/bluetooth_classic.cc index a80e10be8f..f7ddbb29da 100644 --- a/fastpair/internal/mediums/bluetooth_classic.cc +++ b/fastpair/internal/mediums/bluetooth_classic.cc @@ -95,7 +95,7 @@ std::unique_ptr BluetoothClassic::CreatePairing( return nullptr; } if (!IsAvailableLocked()) { - NEARBY_LOGS(VERBOSE) << __func__ + VLOG(1) << __func__ << "Can't create bluetooth pairing because " "BluetoothClassic isn't available."; return nullptr; diff --git a/fastpair/internal/mediums/bluetooth_radio.cc b/fastpair/internal/mediums/bluetooth_radio.cc index 2d85fbcb52..8f87dd660c 100644 --- a/fastpair/internal/mediums/bluetooth_radio.cc +++ b/fastpair/internal/mediums/bluetooth_radio.cc @@ -26,7 +26,7 @@ BluetoothRadio::BluetoothRadio() { } BluetoothRadio::~BluetoothRadio() { - NEARBY_LOGS(VERBOSE) << "~BluetoothRadio start"; + VLOG(1) << "~BluetoothRadio start"; // We never enabled Bluetooth, nothing to do. if (!ever_saved_state_.Get()) { NEARBY_LOGS(INFO) << "BT adapter was not used. Not touching HW."; @@ -36,7 +36,7 @@ BluetoothRadio::~BluetoothRadio() { if (!SetBluetoothState(originally_enabled_.Get())) { NEARBY_LOGS(INFO) << "Failed to restore BT adapter original state."; } - NEARBY_LOGS(VERBOSE) << "~BluetoothRadio done"; + VLOG(1) << "~BluetoothRadio done"; } bool BluetoothRadio::Enable() { diff --git a/fastpair/internal/mediums/robust_gatt_client.cc b/fastpair/internal/mediums/robust_gatt_client.cc index 885db170a3..6e98744bb7 100644 --- a/fastpair/internal/mediums/robust_gatt_client.cc +++ b/fastpair/internal/mediums/robust_gatt_client.cc @@ -311,7 +311,7 @@ void RobustGattClient::Unsubscribe(int uuid_pair_index) { MutexLock lock(&mutex_); int removed = notify_callbacks_.erase(uuid_pair_index); if (removed == 0) { - NEARBY_LOGS(VERBOSE) << "Not subscribed for characteristic no: " + VLOG(1) << "Not subscribed for characteristic no: " << uuid_pair_index; } UnsubscribeInternal(uuid_pair_index); diff --git a/fastpair/message_stream/fake_provider.cc b/fastpair/message_stream/fake_provider.cc index 2c7030bd5a..459bbd0ae9 100644 --- a/fastpair/message_stream/fake_provider.cc +++ b/fastpair/message_stream/fake_provider.cc @@ -137,16 +137,14 @@ void FakeProvider::LoadAntiSpoofingKey(absl::string_view private_key, } std::string FakeProvider::DecryptKbpRequest(absl::string_view request) { - NEARBY_LOGS(VERBOSE) << "Encrypted KBP request " - << absl::BytesToHexString(request); + VLOG(1) << "Encrypted KBP request " << absl::BytesToHexString(request); CHECK_EQ(request.size(), kEncryptedDataByteSize + kPublicKeyByteSize); absl::string_view encrypted = request.substr(0, kEncryptedDataByteSize); absl::string_view remote_public_key = request.substr(kEncryptedDataByteSize, kPublicKeyByteSize); std::string shared_secret = CreateSharedSecret(remote_public_key); std::string decrypted = Aes128Decrypt(encrypted, shared_secret); - NEARBY_LOGS(VERBOSE) << "Decrypted KBP request " - << absl::BytesToHexString(decrypted); + VLOG(1) << "Decrypted KBP request " << absl::BytesToHexString(decrypted); shared_secret_ = shared_secret; return decrypted; } @@ -246,11 +244,10 @@ void FakeProvider::SetKeyBasedPairingCallback() { CHECK(key_based_characteristic_.has_value()); fake_gatt_callbacks_->characteristics_[*key_based_characteristic_] .write_callback = [this](absl::string_view request) { - NEARBY_LOGS(VERBOSE) << "Encrypted request: " - << absl::BytesToHexString(request); + VLOG(1) << "Encrypted request: " << absl::BytesToHexString(request); std::string decrypted_request = DecryptKbpRequest(request); - NEARBY_LOGS(VERBOSE) << "KBP decrypted request " - << absl::BytesToHexString(decrypted_request); + VLOG(1) << "KBP decrypted request " + << absl::BytesToHexString(decrypted_request); fake_gatt_callbacks_->characteristics_[*key_based_characteristic_] .write_value.Set(std::string(decrypted_request)); std::string response; @@ -258,7 +255,7 @@ void FakeProvider::SetKeyBasedPairingCallback() { response.append(GetMacAddressAsBytes()); response.resize(kEncryptedDataByteSize, 0); absl::Status status = NotifyKeyBasedPairing(ByteArray(Encrypt(response))); - NEARBY_LOGS(VERBOSE) << "KBP notify result: " << status; + VLOG(1) << "KBP notify result: " << status; return absl::OkStatus(); }; } @@ -268,11 +265,10 @@ void FakeProvider::SetPasskeyCallback() { CHECK(passkey_characteristic_.has_value()); fake_gatt_callbacks_->characteristics_[*passkey_characteristic_] .write_callback = [this](absl::string_view request) { - NEARBY_LOGS(VERBOSE) << "Passkey Encrypted request: " - << absl::BytesToHexString(request); + VLOG(1) << "Passkey Encrypted request: " << absl::BytesToHexString(request); std::string decrypted = Aes128Decrypt(request, shared_secret_); - NEARBY_LOGS(VERBOSE) << "Passkey decrypted request " - << absl::BytesToHexString(decrypted); + VLOG(1) << "Passkey decrypted request " + << absl::BytesToHexString(decrypted); fake_gatt_callbacks_->characteristics_[*passkey_characteristic_] .write_value.Set(std::string(decrypted)); if (decrypted[0] != kSeekerPasskeyResponseCode) { @@ -287,7 +283,7 @@ void FakeProvider::SetPasskeyCallback() { response.push_back(pass_key_); response.resize(kEncryptedDataByteSize, 0); absl::Status status = NotifyPasskey(ByteArray(Encrypt(response))); - NEARBY_LOGS(VERBOSE) << "Passkey notify result: " << status; + VLOG(1) << "Passkey notify result: " << status; return absl::OkStatus(); }; } @@ -297,11 +293,11 @@ void FakeProvider::SetAccountkeyCallback() { CHECK(accountkey_characteristic_.has_value()); fake_gatt_callbacks_->characteristics_[*accountkey_characteristic_] .write_callback = [this](absl::string_view request) { - NEARBY_LOGS(VERBOSE) << "Account key encrypted request: " - << absl::BytesToHexString(request); + VLOG(1) << "Account key encrypted request: " + << absl::BytesToHexString(request); std::string decrypted = Aes128Decrypt(request, shared_secret_); - NEARBY_LOGS(VERBOSE) << "Account key decrypted request " - << absl::BytesToHexString(decrypted); + VLOG(1) << "Account key decrypted request " + << absl::BytesToHexString(decrypted); fake_gatt_callbacks_->characteristics_[*accountkey_characteristic_] .write_value.Set(std::string(decrypted)); @@ -366,8 +362,7 @@ void FakeProvider::EnableProviderRfcommForRetro(PairingConfig &config) { provider_thread_.Execute([this]() { provider_socket_ = provider_server_socket_.Accept(); if (provider_server_socket_.IsValid()) { - NEARBY_LOGS(VERBOSE) - << "Message stream connected. Sending Model Id and BLE address"; + VLOG(1) << "Message stream connected. Sending Model Id and BLE address"; provider_socket_.GetOutputStream().Write(GetModelIdMessage(model_id_)); provider_socket_.GetOutputStream().Write(GetBleAddressMessage()); } diff --git a/fastpair/pairing/fastpair/fast_pair_pairer_impl.cc b/fastpair/pairing/fastpair/fast_pair_pairer_impl.cc index e2c2113847..d9d68a4baf 100644 --- a/fastpair/pairing/fastpair/fast_pair_pairer_impl.cc +++ b/fastpair/pairing/fastpair/fast_pair_pairer_impl.cc @@ -275,7 +275,7 @@ void FastPairPairerImpl::AttemptSendAccountKey() { // pairing. For subsequent pairing, we have to save the account key // locally so that we can refer to it in API calls to the server. if (device_.GetProtocol() == Protocol::kFastPairSubsequentPairing) { - NEARBY_LOGS(VERBOSE) << __func__ + VLOG(1) << __func__ << ": Saving Account Key locally for subsequent pair"; // TODO(b/278807993): Saving Account Key locally for subsequent pair NotifyPairingCompleted(); @@ -297,7 +297,7 @@ void FastPairPairerImpl::AttemptSendAccountKey() { FastPairRepository::Get()->IsDeviceSavedToAccount( device_.GetPublicAddress().value(), [this](absl::Status status) { if (status.ok()) { - NEARBY_LOGS(VERBOSE) + VLOG(1) << __func__ << ": Device is already saved, skipping write account key. " "Pairing procedure complete."; diff --git a/fastpair/plugins/windows_admin_plugin.cc b/fastpair/plugins/windows_admin_plugin.cc index 4877309b29..f343149a19 100644 --- a/fastpair/plugins/windows_admin_plugin.cc +++ b/fastpair/plugins/windows_admin_plugin.cc @@ -98,7 +98,7 @@ void WindowsAdminPlugin::OnInitialDiscoveryEvent( return; } if (state_->foreground_currently_showing_notification) { - NEARBY_LOGS(VERBOSE) << __func__ + VLOG(1) << __func__ << ": Already showing a notification for a device"; return; } diff --git a/fastpair/proto/proto_builder.cc b/fastpair/proto/proto_builder.cc index 738aaf5a6d..a539581f31 100644 --- a/fastpair/proto/proto_builder.cc +++ b/fastpair/proto/proto_builder.cc @@ -33,7 +33,7 @@ namespace fastpair { void BuildFastPairInfo(::nearby::fastpair::proto::FastPairInfo* fast_pair_info, const FastPairDevice& fast_pair_device) { - NEARBY_LOGS(VERBOSE) << __func__; + VLOG(1) << __func__; const AccountKey& account_key = fast_pair_device.GetAccountKey(); auto& metadata = fast_pair_device.GetMetadata(); DCHECK(metadata); diff --git a/fastpair/repository/fast_pair_device_repository.cc b/fastpair/repository/fast_pair_device_repository.cc index e219a484d5..49996d463d 100644 --- a/fastpair/repository/fast_pair_device_repository.cc +++ b/fastpair/repository/fast_pair_device_repository.cc @@ -53,7 +53,7 @@ void FastPairDeviceRepository::RemoveDevice(const FastPairDevice* device) { for (auto* callback : observers_.GetObservers()) { (*callback)(*fast_pair_device); } - NEARBY_LOGS(VERBOSE) << "Destroyed FP device: " << *fast_pair_device; + VLOG(1) << "Destroyed FP device: " << *fast_pair_device; }); } diff --git a/fastpair/repository/fast_pair_repository_impl.cc b/fastpair/repository/fast_pair_repository_impl.cc index 8dea41cdb6..8c6d45f6a7 100644 --- a/fastpair/repository/fast_pair_repository_impl.cc +++ b/fastpair/repository/fast_pair_repository_impl.cc @@ -265,7 +265,7 @@ void FastPairRepositoryImpl::IsDeviceSavedToAccount( for (const auto& info : response->fast_pair_info()) { if (info.has_device() && IsDeviceSha256Matched(info.device(), mac_address)) { - NEARBY_LOGS(VERBOSE) + VLOG(1) << __func__ << ": found a SHA256 match for device at address = " << mac_address; std::move(callback)(absl::OkStatus()); diff --git a/fastpair/retroactive/retroactive_pairing_detector_impl.cc b/fastpair/retroactive/retroactive_pairing_detector_impl.cc index 5bcffb7349..5b8e0cdfa5 100644 --- a/fastpair/retroactive/retroactive_pairing_detector_impl.cc +++ b/fastpair/retroactive/retroactive_pairing_detector_impl.cc @@ -91,7 +91,7 @@ void RetroactivePairingDetectorImpl::DevicePairedChanged( device.GetMacAddress(), [this, mac_address = device.GetMacAddress()](absl::Status status) { if (status.ok()) { - NEARBY_LOGS(VERBOSE) << __func__ + VLOG(1) << __func__ << ": Ignoring because device is already saved " "to the current account."; return; @@ -102,7 +102,7 @@ void RetroactivePairingDetectorImpl::DevicePairedChanged( void RetroactivePairingDetectorImpl::NotifyRetroactiveDeviceFound( absl::string_view mac_address) { - NEARBY_LOGS(VERBOSE) << __func__ << ": mac_address = " << mac_address; + VLOG(1) << __func__ << ": mac_address = " << mac_address; auto fast_pair_device = std::make_unique(Protocol::kFastPairRetroactivePairing); fast_pair_device->SetPublicAddress(mac_address); diff --git a/fastpair/scanning/fastpair/fast_pair_discoverable_scanner.cc b/fastpair/scanning/fastpair/fast_pair_discoverable_scanner.cc index 5206bf93d2..99c3b435ce 100644 --- a/fastpair/scanning/fastpair/fast_pair_discoverable_scanner.cc +++ b/fastpair/scanning/fastpair/fast_pair_discoverable_scanner.cc @@ -200,7 +200,7 @@ void FastPairDiscoverableScanner::OnDeviceMetadataRetrieved( } void FastPairDiscoverableScanner::NotifyDeviceFound(FastPairDevice& device) { - NEARBY_LOGS(VERBOSE) << "Notify Device found:" + VLOG(1) << "Notify Device found:" << "BluetoothAddress = " << device.GetBleAddress() << ", Model id = " << device.GetModelId(); { diff --git a/fastpair/scanning/fastpair/fast_pair_non_discoverable_scanner.cc b/fastpair/scanning/fastpair/fast_pair_non_discoverable_scanner.cc index 009ab87ee0..32b04c8b7e 100644 --- a/fastpair/scanning/fastpair/fast_pair_non_discoverable_scanner.cc +++ b/fastpair/scanning/fastpair/fast_pair_non_discoverable_scanner.cc @@ -166,7 +166,7 @@ void FastPairNonDiscoverableScanner::OnDeviceMetadataRetrieved( } void FastPairNonDiscoverableScanner::NotifyDeviceFound(FastPairDevice& device) { - NEARBY_LOGS(VERBOSE) << "Notify Device found:" + VLOG(1) << "Notify Device found:" << "BluetoothAddress = " << device.GetBleAddress() << ", Model id = " << device.GetModelId(); { diff --git a/fastpair/scanning/fastpair/fast_pair_scanner_impl.cc b/fastpair/scanning/fastpair/fast_pair_scanner_impl.cc index 825e9000f9..cd5e6e0135 100644 --- a/fastpair/scanning/fastpair/fast_pair_scanner_impl.cc +++ b/fastpair/scanning/fastpair/fast_pair_scanner_impl.cc @@ -36,7 +36,7 @@ class ScanningSessionImpl : public FastPairScanner::ScanningSession { explicit ScanningSessionImpl(FastPairScannerImpl* scanner) : scanner_(scanner) {} ~ScanningSessionImpl() override { - NEARBY_LOGS(VERBOSE) << __func__; + VLOG(1) << __func__; scanner_->StopScanning(); } @@ -61,14 +61,14 @@ void FastPairScannerImpl::RemoveObserver(FastPairScanner::Observer* observer) { std::unique_ptr FastPairScannerImpl::StartScanning() { - NEARBY_LOGS(VERBOSE) << __func__; + VLOG(1) << __func__; executor_->Execute("scanning", [this]() ABSL_EXCLUSIVE_LOCKS_REQUIRED( *executor_) { StartScanningInternal(); }); return std::make_unique(this); } void FastPairScannerImpl::StartScanningInternal() { - NEARBY_LOGS(VERBOSE) << __func__; + VLOG(1) << __func__; if (mediums_.GetBluetoothRadio().Enable() && mediums_.GetBle().IsAvailable() && mediums_.GetBle().StartScanning( @@ -108,10 +108,10 @@ void FastPairScannerImpl::StartScanningInternal() { } void FastPairScannerImpl::StopScanning() { - NEARBY_LOGS(VERBOSE) << __func__; + VLOG(1) << __func__; executor_->Execute("stop-scan", [this]() ABSL_EXCLUSIVE_LOCKS_REQUIRED(*executor_) { - NEARBY_LOGS(VERBOSE) << __func__ << " in background"; + VLOG(1) << __func__ << " in background"; timer_.reset(); mediums_.GetBle().StopScanning(kServiceId); }); diff --git a/fastpair/scanning/scanner_broker_impl.cc b/fastpair/scanning/scanner_broker_impl.cc index 92f1a7b307..f2d4c47672 100644 --- a/fastpair/scanning/scanner_broker_impl.cc +++ b/fastpair/scanning/scanner_broker_impl.cc @@ -61,7 +61,7 @@ std::unique_ptr ScannerBrokerImpl::StartScanning(Protocol protocol) { DCHECK(!fast_pair_discoverable_scanner_); DCHECK(!fast_pair_non_discoverable_scanner_); - NEARBY_LOGS(VERBOSE) << "Starting Fast Pair Scanning."; + VLOG(1) << "Starting Fast Pair Scanning."; scanner_ = std::make_unique(mediums_, executor_); fast_pair_discoverable_scanner_ = FastPairDiscoverableScanner::Factory::Create( @@ -81,7 +81,7 @@ ScannerBrokerImpl::StartScanning(Protocol protocol) { } void ScannerBrokerImpl::StopScanning(Protocol protocol) { - NEARBY_LOGS(VERBOSE) << __func__ << " Stopping Fast Pair Scanning."; + VLOG(1) << __func__ << " Stopping Fast Pair Scanning."; scanning_session_.reset(); observers_.Clear(); diff --git a/fastpair/server_access/fast_pair_client_impl.cc b/fastpair/server_access/fast_pair_client_impl.cc index 515c65f161..0f336df261 100644 --- a/fastpair/server_access/fast_pair_client_impl.cc +++ b/fastpair/server_access/fast_pair_client_impl.cc @@ -108,7 +108,7 @@ FastPairClientImpl::FastPairClientImpl( absl::StatusOr FastPairClientImpl::GetObservedDevice( const proto::GetObservedDeviceRequest& request) { - NEARBY_LOGS(VERBOSE) << __func__ << ": Start API call to get observed device"; + VLOG(1) << __func__ << ": Start API call to get observed device"; notifier_->NotifyOfRequest(request); // Sets up request mode. @@ -148,7 +148,7 @@ FastPairClientImpl::GetObservedDevice( absl::StatusOr FastPairClientImpl::UserReadDevices( const proto::UserReadDevicesRequest& request) { - NEARBY_LOGS(VERBOSE) << __func__ << ": Start API call to read user's devices"; + VLOG(1) << __func__ << ": Start API call to read user's devices"; notifier_->NotifyOfRequest(request); absl::StatusOr access_token = GetAccessToken(); @@ -189,7 +189,7 @@ FastPairClientImpl::UserReadDevices( absl::StatusOr FastPairClientImpl::UserWriteDevice( const proto::UserWriteDeviceRequest& request) { - NEARBY_LOGS(VERBOSE) << __func__ << ": Start API call to write user device"; + VLOG(1) << __func__ << ": Start API call to write user device"; notifier_->NotifyOfRequest(request); absl::StatusOr access_token = GetAccessToken(); @@ -229,7 +229,7 @@ FastPairClientImpl::UserWriteDevice( absl::StatusOr FastPairClientImpl::UserDeleteDevice( const proto::UserDeleteDeviceRequest& request) { - NEARBY_LOGS(VERBOSE) << __func__ << ": Start API call to delete user device"; + VLOG(1) << __func__ << ": Start API call to delete user device"; notifier_->NotifyOfRequest(request); absl::StatusOr access_token = GetAccessToken(); @@ -271,7 +271,7 @@ FastPairClientImpl::UserDeleteDevice( // Blocking function absl::StatusOr FastPairClientImpl::GetAccessToken() { - NEARBY_LOGS(VERBOSE) << __func__; + VLOG(1) << __func__; std::optional account = account_manager_->GetCurrentAccount(); if (!account.has_value()) { @@ -300,7 +300,7 @@ HttpRequest FastPairClientImpl::CreateHttpRequest( RequestType request_type, std::optional request_as_query_parameters, std::optional body) { - NEARBY_LOGS(VERBOSE) << __func__; + VLOG(1) << __func__; HttpRequest request{url}; // Handles query strings diff --git a/fastpair/server_access/fast_pair_http_notifier.cc b/fastpair/server_access/fast_pair_http_notifier.cc index 24f7acd05d..b652229444 100644 --- a/fastpair/server_access/fast_pair_http_notifier.cc +++ b/fastpair/server_access/fast_pair_http_notifier.cc @@ -32,7 +32,7 @@ void FastPairHttpNotifier::RemoveObserver(Observer* observer) { // Notifies all observers of GetObservedDeviceRequest/Response void FastPairHttpNotifier::NotifyOfRequest( const proto::GetObservedDeviceRequest& request) { - NEARBY_LOGS(VERBOSE) << ": GetObservedDeviceRequest=" + VLOG(1) << ": GetObservedDeviceRequest=" << FastPairProtoToJson(request).dump(); for (auto& observer : observers_.GetObservers()) observer->OnGetObservedDeviceRequest(request); @@ -40,7 +40,7 @@ void FastPairHttpNotifier::NotifyOfRequest( void FastPairHttpNotifier::NotifyOfResponse( const proto::GetObservedDeviceResponse& response) { - NEARBY_LOGS(VERBOSE) << ": GetObservedDeviceResponse=" + VLOG(1) << ": GetObservedDeviceResponse=" << FastPairProtoToJson(response).dump(); for (auto& observer : observers_.GetObservers()) observer->OnGetObservedDeviceResponse(response); @@ -49,7 +49,7 @@ void FastPairHttpNotifier::NotifyOfResponse( // Notifies all observers of UserReadDevicesRequest/Response void FastPairHttpNotifier::NotifyOfRequest( const proto::UserReadDevicesRequest& request) { - NEARBY_LOGS(VERBOSE) << ": UserReadDevicesRequest=" + VLOG(1) << ": UserReadDevicesRequest=" << FastPairProtoToJson(request).dump(); for (auto& observer : observers_.GetObservers()) observer->OnUserReadDevicesRequest(request); @@ -57,7 +57,7 @@ void FastPairHttpNotifier::NotifyOfRequest( void FastPairHttpNotifier::NotifyOfResponse( const proto::UserReadDevicesResponse& response) { - NEARBY_LOGS(VERBOSE) << ": UserReadDevicesResponse=" + VLOG(1) << ": UserReadDevicesResponse=" << FastPairProtoToJson(response).dump(); for (auto& observer : observers_.GetObservers()) observer->OnUserReadDevicesResponse(response); @@ -66,7 +66,7 @@ void FastPairHttpNotifier::NotifyOfResponse( // Notifies all observers of UserWriteDeviceRequest/Response void FastPairHttpNotifier::NotifyOfRequest( const proto::UserWriteDeviceRequest& request) { - NEARBY_LOGS(VERBOSE) << ": UserWriteDeviceRequest=" + VLOG(1) << ": UserWriteDeviceRequest=" << FastPairProtoToJson(request).dump(); for (auto& observer : observers_.GetObservers()) observer->OnUserWriteDeviceRequest(request); @@ -81,14 +81,14 @@ void FastPairHttpNotifier::NotifyOfResponse( // Notifies all observers of UserDeleteDeviceRequest/Response void FastPairHttpNotifier::NotifyOfRequest( const proto::UserDeleteDeviceRequest& request) { - NEARBY_LOGS(VERBOSE) << ": UserDeleteDeviceRequest=" + VLOG(1) << ": UserDeleteDeviceRequest=" << FastPairProtoToJson(request).dump(); for (auto& observer : observers_.GetObservers()) observer->OnUserDeleteDeviceRequest(request); } void FastPairHttpNotifier::NotifyOfResponse( const proto::UserDeleteDeviceResponse& response) { - NEARBY_LOGS(VERBOSE) << ": UserDeleteDeviceResponse=" + VLOG(1) << ": UserDeleteDeviceResponse=" << FastPairProtoToJson(response).dump(); for (auto& observer : observers_.GetObservers()) observer->OnUserDeleteDeviceResponse(response); diff --git a/fastpair/ui/ui_broker_impl.cc b/fastpair/ui/ui_broker_impl.cc index 6b3c7b3c06..06e56fc124 100644 --- a/fastpair/ui/ui_broker_impl.cc +++ b/fastpair/ui/ui_broker_impl.cc @@ -46,7 +46,7 @@ void UIBrokerImpl::ShowDiscovery( case Protocol::kFastPairSubsequentPairing: fast_pair_presenter_->ShowDiscovery( device, notification_controller, [&](DiscoveryAction action) { - NEARBY_LOGS(VERBOSE) + VLOG(1) << __func__ << "ui broker notify discovery action of device: " << device; NotifyDiscoveryAction(device, action); @@ -63,7 +63,7 @@ void UIBrokerImpl::ShowDiscovery( void UIBrokerImpl::ShowPairingResult( FastPairDevice& device, FastPairNotificationController& notification_controller, bool success) { - NEARBY_LOGS(VERBOSE) << __func__; + VLOG(1) << __func__; switch (device.GetProtocol()) { case Protocol::kFastPairInitialPairing: case Protocol::kFastPairSubsequentPairing: