Commit dfb7d602 authored by Juliet Levesque's avatar Juliet Levesque Committed by Commit Bot

[Nearby] Replace logging instances with NS_LOG macro.

Allows logging instances used for Nearby Share to show up on
chrome://nearby-internals logging tab.

Bug: 1093634
Change-Id: I67e4b128fcd2fed8564a7cec3ee2df22f0572833
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2265452Reviewed-by: default avatarJosh Nohle <nohle@chromium.org>
Reviewed-by: default avatarJames Vecore <vecore@google.com>
Commit-Queue: Juliet Levesque <julietlevesque@google.com>
Cr-Commit-Position: refs/heads/master@{#785900}
parent 22693054
......@@ -4,8 +4,8 @@
#include "chrome/browser/nearby_sharing/client/nearby_share_api_call_flow_impl.h"
#include "base/logging.h"
#include "base/strings/string_number_conversions.h"
#include "chrome/browser/nearby_sharing/logging/logging.h"
#include "net/base/net_errors.h"
#include "net/base/url_util.h"
#include "net/traffic_annotation/network_traffic_annotation.h"
......@@ -153,10 +153,10 @@ void NearbyShareApiCallFlowImpl::ProcessApiCallFailure(
error = NearbyShareRequestError::kOffline;
}
LOG(ERROR) << "API call failed, error code: "
<< net::ErrorToString(net_error);
NS_LOG(ERROR) << "API call failed, error code: "
<< net::ErrorToString(net_error);
if (body)
VLOG(1) << "API failure response body: " << *body;
NS_LOG(VERBOSE) << "API failure response body: " << *body;
std::move(error_callback_).Run(*error);
}
......
......@@ -10,9 +10,9 @@
#include <vector>
#include "base/bind_helpers.h"
#include "base/logging.h"
#include "base/time/time.h"
#include "build/build_config.h"
#include "chrome/browser/nearby_sharing/logging/logging.h"
#include "device/bluetooth/bluetooth_adapter_factory.h"
#include "device/bluetooth/bluetooth_advertisement.h"
......@@ -177,7 +177,7 @@ void FastInitiationManager::OnRegisterAdvertisement(
void FastInitiationManager::OnRegisterAdvertisementError(
device::BluetoothAdvertisement::ErrorCode error_code) {
LOG(ERROR)
NS_LOG(ERROR)
<< "FastInitiationManager::StartAdvertising() failed with error code = "
<< error_code;
std::move(start_error_callback_).Run();
......@@ -210,7 +210,7 @@ void FastInitiationManager::OnUnregisterAdvertisement() {
void FastInitiationManager::OnUnregisterAdvertisementError(
device::BluetoothAdvertisement::ErrorCode error_code) {
LOG(WARNING)
NS_LOG(WARNING)
<< "FastInitiationManager::StopAdvertising() failed with error code = "
<< error_code;
advertisement_.reset();
......
......@@ -11,6 +11,7 @@
#include "base/files/file_path.h"
#include "build/build_config.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/nearby_sharing/logging/logging.h"
#include "chrome/browser/nearby_sharing/nearby_sharing_prefs.h"
#include "chrome/browser/nearby_sharing/webrtc_signaling_messenger.h"
#include "chrome/browser/profiles/profile.h"
......@@ -188,15 +189,15 @@ void NearbyProcessManager::BindSharingProcess(
void NearbyProcessManager::GetBluetoothAdapter(
location::nearby::connections::mojom::NearbyConnectionsHost::
GetBluetoothAdapterCallback callback) {
DVLOG(1) << __func__
<< " Request for Bluetooth "
"adapter received on the browser process.";
NS_LOG(VERBOSE) << __func__
<< " Request for Bluetooth "
"adapter received on the browser process.";
if (device::BluetoothAdapterFactory::IsBluetoothSupported()) {
device::BluetoothAdapterFactory::Get()->GetAdapter(
base::BindOnce(&NearbyProcessManager::OnGetBluetoothAdapter,
base::Unretained(this), std::move(callback)));
} else {
DVLOG(1)
NS_LOG(VERBOSE)
<< __func__
<< " Bluetooth is not supported on this device, returning NullRemote";
std::move(callback).Run(/*adapter=*/mojo::NullRemote());
......@@ -270,7 +271,7 @@ void NearbyProcessManager::OnNearbyConnections(
mojo::PendingReceiver<NearbyConnectionsMojom> receiver,
mojo::PendingRemote<NearbyConnectionsMojom> remote) {
if (!mojo::FusePipes(std::move(receiver), std::move(remote))) {
LOG(WARNING) << "Failed to initialize Nearby Connections process";
NS_LOG(WARNING) << "Failed to initialize Nearby Connections process";
StopProcess(active_profile_);
return;
}
......@@ -304,7 +305,7 @@ void NearbyProcessManager::OnNearbySharingDecoder(
mojo::PendingReceiver<NearbySharingDecoderMojom> receiver,
mojo::PendingRemote<NearbySharingDecoderMojom> remote) {
if (!mojo::FusePipes(std::move(receiver), std::move(remote))) {
LOG(WARNING) << "Failed to initialize Nearby Sharing Decoder process";
NS_LOG(WARNING) << "Failed to initialize Nearby Sharing Decoder process";
StopProcess(active_profile_);
return;
}
......@@ -317,7 +318,8 @@ void NearbyProcessManager::OnGetBluetoothAdapter(
location::nearby::connections::mojom::NearbyConnectionsHost::
GetBluetoothAdapterCallback callback,
scoped_refptr<device::BluetoothAdapter> adapter) {
DVLOG(1) << __func__ << " Got adapter instance, returning to utility process";
NS_LOG(VERBOSE) << __func__
<< " Got adapter instance, returning to utility process";
mojo::PendingRemote<bluetooth::mojom::Adapter> pending_adapter;
mojo::MakeSelfOwnedReceiver(std::make_unique<bluetooth::Adapter>(adapter),
pending_adapter.InitWithNewPipeAndPassReceiver());
......
......@@ -10,6 +10,7 @@
#include "base/memory/singleton.h"
#include "build/build_config.h"
#include "chrome/browser/browser_features.h"
#include "chrome/browser/nearby_sharing/logging/logging.h"
#include "chrome/browser/nearby_sharing/nearby_connections_manager.h"
#include "chrome/browser/nearby_sharing/nearby_connections_manager_impl.h"
#include "chrome/browser/nearby_sharing/nearby_sharing_prefs.h"
......@@ -47,7 +48,8 @@ NearbySharingServiceFactory::~NearbySharingServiceFactory() = default;
KeyedService* NearbySharingServiceFactory::BuildServiceInstanceFor(
content::BrowserContext* context) const {
if (!base::FeatureList::IsEnabled(features::kNearbySharing)) {
VLOG(1) << __func__ << ": Nearby Sharing feature flag is not enabled.";
NS_LOG(VERBOSE) << __func__
<< ": Nearby Sharing feature flag is not enabled.";
return nullptr;
}
......@@ -56,7 +58,7 @@ KeyedService* NearbySharingServiceFactory::BuildServiceInstanceFor(
auto nearby_connections_manager =
std::make_unique<NearbyConnectionsManagerImpl>();
VLOG(1) << __func__ << ": creating NearbySharingService.";
NS_LOG(VERBOSE) << __func__ << ": creating NearbySharingService.";
return new NearbySharingServiceImpl(pref_service, profile,
std::move(nearby_connections_manager));
}
......
......@@ -7,9 +7,9 @@
#include <utility>
#include "base/bind.h"
#include "base/logging.h"
#include "base/threading/thread_task_runner_handle.h"
#include "chrome/browser/nearby_sharing/fast_initiation_manager.h"
#include "chrome/browser/nearby_sharing/logging/logging.h"
#include "chrome/browser/nearby_sharing/nearby_connections_manager.h"
#include "chrome/browser/nearby_sharing/nearby_sharing_prefs.h"
#include "chrome/services/sharing/public/cpp/advertisement.h"
......@@ -291,7 +291,7 @@ void NearbySharingServiceImpl::OnNearbyProfileChanged(Profile* profile) {
void NearbySharingServiceImpl::OnNearbyProcessStarted() {
NearbyProcessManager& process_manager = NearbyProcessManager::GetInstance();
if (process_manager.IsActiveProfile(profile_))
VLOG(1) << __func__ << ": Nearby process started!";
NS_LOG(VERBOSE) << __func__ << ": Nearby process started!";
}
void NearbySharingServiceImpl::OnNearbyProcessStopped() {
......@@ -315,9 +315,9 @@ bool NearbySharingServiceImpl::IsEnabled() {
void NearbySharingServiceImpl::OnEnabledPrefChanged() {
if (IsEnabled()) {
VLOG(1) << __func__ << ": Nearby sharing enabled!";
NS_LOG(VERBOSE) << __func__ << ": Nearby sharing enabled!";
} else {
VLOG(1) << __func__ << ": Nearby sharing disabled!";
NS_LOG(VERBOSE) << __func__ << ": Nearby sharing disabled!";
StopAdvertising();
// TODO(crbug/1085067): Stop discovery.
nearby_connections_manager_->Shutdown();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment