Skip to content

Commit

Permalink
Internal logging update
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 669420403
  • Loading branch information
ggli-google authored and copybara-github committed Aug 30, 2024
1 parent e65a8a5 commit d5b5d92
Show file tree
Hide file tree
Showing 69 changed files with 626 additions and 733 deletions.
2 changes: 1 addition & 1 deletion Package.resolved
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"location" : "https://github.com/bourdakos1/abseil-cpp-SwiftPM.git",
"state" : {
"branch" : "cxx17-test",
"revision" : "df22baef6992ac19219337c2a59a4c759fc92c0f"
"revision" : "f2c56293ba0c7dc4fed62c38dfea5c5c2d632166"
}
},
{
Expand Down
1 change: 0 additions & 1 deletion Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -535,7 +535,6 @@ let package = Package(
"internal/platform/bluetooth_connection_info_test.cc",
"internal/platform/mutex_test.cc",
"internal/platform/atomic_reference_test.cc",
"internal/platform/logging_test.cc",
"internal/platform/multi_thread_executor_test.cc",
"internal/platform/ble_connection_info_test.cc",
"internal/platform/ble_test.cc",
Expand Down
1 change: 1 addition & 0 deletions connections/c/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ cc_library(
"//internal/platform:base",
"//internal/platform:types",
"//proto:connections_enums_cc_proto",
"@com_google_absl//absl/log",
"@com_google_absl//absl/strings:str_format",
"@com_google_absl//absl/strings:string_view",
"@com_google_absl//absl/types:span",
Expand Down
2 changes: 1 addition & 1 deletion connections/c/core_adapter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ namespace nearby::windows {

Core *InitCore(connections::ServiceControllerRouter *router) {
#if defined(LOG_SEVERITY_VERBOSE)
NEARBY_LOG_SET_SEVERITY(VERBOSE);
absl::SetGlobalVLogLevel(1);
#endif // LOG_SEVERITY_VERBOSE;
return new nearby::connections::Core(router);
}
Expand Down
1 change: 1 addition & 0 deletions connections/implementation/analytics/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ cc_library(
"@com_google_absl//absl/strings",
"@com_google_absl//absl/strings:str_format",
"@com_google_absl//absl/time",
"@com_google_protobuf//:protobuf_lite",
],
)

Expand Down
32 changes: 16 additions & 16 deletions connections/implementation/analytics/analytics_recorder.cc
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@
#include "absl/container/btree_map.h"
#include "absl/strings/string_view.h"
#include "absl/time/time.h"
#include "connections/implementation/analytics/connection_attempt_metadata_params.h"
#include "connections/payload_type.h"
#include "connections/strategy.h"
#include "internal/analytics/event_logger.h"
#include "internal/platform/count_down_latch.h"
#include "internal/platform/error_code_params.h"
Expand All @@ -37,6 +39,7 @@
#include "internal/platform/single_thread_executor.h"
#include "internal/proto/analytics/connections_log.pb.h"
#include "proto/connections_enums.pb.h"
#include "google/protobuf/repeated_ptr_field.h"

namespace nearby {
namespace analytics {
Expand Down Expand Up @@ -492,9 +495,9 @@ void AnalyticsRecorder::OnConnectionClosed(const std::string &endpoint_id,
}

if (current_strategy_session_ == nullptr) {
NEARBY_LOGS(VERBOSE)
<< "AnalyticsRecorder CanRecordAnalytics Unexpected call " << __func__
<< " since current_strategy_session_ is required.";
NEARBY_VLOG(1) << "AnalyticsRecorder CanRecordAnalytics Unexpected call "
<< __func__
<< " since current_strategy_session_ is required.";
return;
}

Expand Down Expand Up @@ -708,9 +711,8 @@ void AnalyticsRecorder::OnErrorCode(const ErrorCodeParams &params) {
connections_log.set_version(kVersion);
connections_log.set_allocated_error_code(error_code);

NEARBY_LOGS(VERBOSE)
<< "AnalyticsRecorder LogErrorCode connections_log="
<< connections_log.DebugString();
NEARBY_VLOG(1) << "AnalyticsRecorder LogErrorCode connections_log="
<< connections_log.DebugString(); // NOLINT

event_logger_->Log(connections_log);
});
Expand Down Expand Up @@ -772,16 +774,15 @@ AnalyticsRecorder::BuildConnectionAttemptMetadataParams(

bool AnalyticsRecorder::CanRecordAnalyticsLocked(
absl::string_view method_name) {
NEARBY_LOGS(VERBOSE) << "AnalyticsRecorder LogEvent " << method_name
<< " is calling.";
NEARBY_VLOG(1) << "AnalyticsRecorder LogEvent " << method_name
<< " is calling.";
if (event_logger_ == nullptr) {
return false;
}

if (session_was_logged_) {
NEARBY_LOGS(VERBOSE)
<< "AnalyticsRecorder CanRecordAnalytics Unexpected call "
<< method_name << " after session has already been logged.";
NEARBY_VLOG(1) << "AnalyticsRecorder CanRecordAnalytics Unexpected call "
<< method_name << " after session has already been logged.";
return false;
}

Expand All @@ -797,9 +798,8 @@ void AnalyticsRecorder::LogClientSessionLocked() {
connections_log.set_allocated_client_session(client_session.release());
connections_log.set_version(kVersion);

NEARBY_LOGS(VERBOSE)
<< "AnalyticsRecorder LogClientSession connections_log="
<< connections_log.DebugString();
NEARBY_VLOG(1) << "AnalyticsRecorder LogClientSession connections_log="
<< connections_log.DebugString(); // NOLINT

event_logger_->Log(connections_log);
});
Expand All @@ -812,8 +812,8 @@ void AnalyticsRecorder::LogEvent(EventType event_type) {
connections_log.set_event_type(event_type);
connections_log.set_version(kVersion);

NEARBY_LOGS(VERBOSE) << "AnalyticsRecorder LogEvent connections_log="
<< connections_log.DebugString();
NEARBY_VLOG(1) << "AnalyticsRecorder LogEvent connections_log="
<< connections_log.DebugString(); // NOLINT

event_logger_->Log(connections_log);
});
Expand Down
2 changes: 1 addition & 1 deletion connections/implementation/base_endpoint_channel.cc
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ void BaseEndpointChannel::Close() {
// In case channel is paused, resume it first thing.
MutexLock lock(&is_paused_mutex_);
if (is_closed_) {
NEARBY_LOGS(VERBOSE) << "EndpointChannel already closed";
NEARBY_VLOG(1) << "EndpointChannel already closed";
return;
}
is_closed_ = true;
Expand Down
4 changes: 2 additions & 2 deletions connections/implementation/base_pcp_handler.cc
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ BasePcpHandler::BasePcpHandler(Mediums* mediums,
bwu_manager_(bwu_manager) {}

BasePcpHandler::~BasePcpHandler() {
NEARBY_LOGS(VERBOSE) << __func__;
NEARBY_VLOG(1) << __func__;
Shutdown();
}

Expand Down Expand Up @@ -630,7 +630,7 @@ void BasePcpHandler::OnEncryptionSuccessRunnableV3(
return;
}

NEARBY_LOGS(VERBOSE)
NEARBY_VLOG(1)
<< __func__
<< ": beginning authentication to the remote device as an initiator";
ConnectionsAuthenticationTransport connections_authentication_transport =
Expand Down
13 changes: 6 additions & 7 deletions connections/implementation/bluetooth_bwu_handler.cc
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,10 @@ BluetoothBwuHandler::CreateUpgradedEndpointChannel(
const std::string& service_name = bluetooth_credentials.service_name();
const std::string& mac_address = bluetooth_credentials.mac_address();

NEARBY_LOGS(VERBOSE) << "BluetoothBwuHandler is attempting to connect to "
"available Bluetooth device ("
<< service_name << ", " << mac_address
<< ") for endpoint " << endpoint_id << " and service ID "
<< service_id;
NEARBY_VLOG(1) << "BluetoothBwuHandler is attempting to connect to "
"available Bluetooth device ("
<< service_name << ", " << mac_address << ") for endpoint "
<< endpoint_id << " and service ID " << service_id;

BluetoothDevice device = bluetooth_medium_.GetRemoteDevice(mac_address);
if (!device.IsValid()) {
Expand All @@ -78,7 +77,7 @@ BluetoothBwuHandler::CreateUpgradedEndpointChannel(
return nullptr;
}

NEARBY_LOGS(VERBOSE)
NEARBY_VLOG(1)
<< "BluetoothBwuHandler successfully connected to Bluetooth device ("
<< service_id << ", " << mac_address << ") while upgrading endpoint "
<< endpoint_id;
Expand Down Expand Up @@ -125,7 +124,7 @@ ByteArray BluetoothBwuHandler::HandleInitializeUpgradedMediumForEndpoint(

return {};
}
NEARBY_LOGS(VERBOSE)
NEARBY_VLOG(1)
<< "BluetoothBwuHandler successfully started listening for incoming "
"Bluetooth connections on service_id="
<< upgrade_service_id << " while upgrading endpoint " << endpoint_id;
Expand Down
Loading

0 comments on commit d5b5d92

Please sign in to comment.