Remove legacy log macros.

PiperOrigin-RevId: 734977247
This commit is contained in:
Francis Tsui
2025-03-08 16:36:16 -08:00
committed by Copybara-Service
parent e3302b720b
commit 5038280159
11 changed files with 94 additions and 120 deletions
+5 -5
View File
@@ -83,9 +83,9 @@ std::vector<uint8_t> GenerateRandomBytes(size_t num_bytes) {
std::unique_ptr<crypto::Encryptor> CreateNearbyShareCtrEncryptor(
const crypto::SymmetricKey* secret_key, absl::Span<const uint8_t> salt) {
NL_DCHECK(secret_key);
NL_DCHECK_EQ(kNearbyShareNumBytesSecretKey, secret_key->key().size());
NL_DCHECK_EQ(kNearbyShareNumBytesMetadataEncryptionKeySalt, salt.size());
DCHECK(secret_key);
DCHECK_EQ(kNearbyShareNumBytesSecretKey, secret_key->key().size());
DCHECK_EQ(kNearbyShareNumBytesMetadataEncryptionKeySalt, salt.size());
auto encryptor = std::make_unique<crypto::Encryptor>();
@@ -93,14 +93,14 @@ std::unique_ptr<crypto::Encryptor> CreateNearbyShareCtrEncryptor(
// set via SetCounter().
if (!encryptor->Init(secret_key, crypto::Encryptor::Mode::CTR,
/*iv=*/absl::Span<const uint8_t>())) {
NL_LOG(ERROR) << "Encryptor could not be initialized.";
LOG(ERROR) << "Encryptor could not be initialized.";
return nullptr;
}
std::vector<uint8_t> iv =
DeriveNearbyShareKey(salt, kNearbyShareNumBytesAesCtrIv);
if (!encryptor->SetCounter(iv)) {
NL_LOG(ERROR) << "Could not set encryptor counter.";
LOG(ERROR) << "Could not set encryptor counter.";
return nullptr;
}
@@ -290,7 +290,7 @@ class NearbyShareCertificateManagerImplTest
std::max(max_not_after_self_share, cert.not_after());
break;
default:
NL_DCHECK(false);
DCHECK(false);
break;
}
@@ -28,9 +28,8 @@ namespace sharing {
NearbyShareEncryptedMetadataKey::NearbyShareEncryptedMetadataKey(
std::vector<uint8_t> salt, std::vector<uint8_t> encrypted_key)
: salt_(std::move(salt)), encrypted_key_(std::move(encrypted_key)) {
NL_DCHECK_EQ(kNearbyShareNumBytesMetadataEncryptionKeySalt, salt_.size());
NL_DCHECK_EQ(kNearbyShareNumBytesMetadataEncryptionKey,
encrypted_key_.size());
DCHECK_EQ(kNearbyShareNumBytesMetadataEncryptionKeySalt, salt_.size());
DCHECK_EQ(kNearbyShareNumBytesMetadataEncryptionKey, encrypted_key_.size());
}
NearbyShareEncryptedMetadataKey::NearbyShareEncryptedMetadataKey(
@@ -68,7 +68,7 @@ absl::Duration GenerateRandomOffset() {
// Generates a certificate identifier by hashing the input secret |key|.
std::vector<uint8_t> CreateCertificateIdFromSecretKey(
const crypto::SymmetricKey& key) {
NL_DCHECK_EQ(crypto::kSHA256Length, kNearbyShareNumBytesCertificateId);
DCHECK_EQ(crypto::kSHA256Length, kNearbyShareNumBytesCertificateId);
std::vector<uint8_t> id(kNearbyShareNumBytesCertificateId);
crypto::SHA256HashString(key.key(), id.data(), id.size());
@@ -132,7 +132,7 @@ std::string SaltsToString(const std::set<std::vector<uint8_t>>& salts) {
std::set<std::vector<uint8_t>> StringToSalts(absl::string_view str) {
const size_t chars_per_salt =
2 * kNearbyShareNumBytesMetadataEncryptionKeySalt;
NL_DCHECK_EQ(str.size() % chars_per_salt, 0);
DCHECK_EQ(str.size() % chars_per_salt, 0);
std::set<std::vector<uint8_t>> salts;
for (size_t i = 0; i < str.size(); i += chars_per_salt) {
std::string bytes =
@@ -159,9 +159,8 @@ NearbySharePrivateCertificate::NearbySharePrivateCertificate(
GenerateRandomBytes(kNearbyShareNumBytesMetadataEncryptionKey)),
id_(CreateCertificateIdFromSecretKey(*secret_key_)),
unencrypted_metadata_(std::move(unencrypted_metadata)) {
NL_DCHECK_NE(
static_cast<int>(visibility),
static_cast<int>(DeviceVisibility::DEVICE_VISIBILITY_UNSPECIFIED));
DCHECK_NE(static_cast<int>(visibility),
static_cast<int>(DeviceVisibility::DEVICE_VISIBILITY_UNSPECIFIED));
}
NearbySharePrivateCertificate::NearbySharePrivateCertificate(
@@ -180,9 +179,8 @@ NearbySharePrivateCertificate::NearbySharePrivateCertificate(
id_(std::move(id)),
unencrypted_metadata_(std::move(unencrypted_metadata)),
consumed_salts_(std::move(consumed_salts)) {
NL_DCHECK_NE(
static_cast<int>(visibility),
static_cast<int>(DeviceVisibility::DEVICE_VISIBILITY_UNSPECIFIED));
DCHECK_NE(static_cast<int>(visibility),
static_cast<int>(DeviceVisibility::DEVICE_VISIBILITY_UNSPECIFIED));
}
NearbySharePrivateCertificate::NearbySharePrivateCertificate(
@@ -221,22 +219,22 @@ std::optional<NearbyShareEncryptedMetadataKey>
NearbySharePrivateCertificate::EncryptMetadataKey() {
std::optional<std::vector<uint8_t>> salt = GenerateUnusedSalt();
if (!salt) {
NL_LOG(ERROR) << "Encryption failed: Salt generation unsuccessful.";
LOG(ERROR) << "Encryption failed: Salt generation unsuccessful.";
return std::nullopt;
}
std::unique_ptr<crypto::Encryptor> encryptor =
CreateNearbyShareCtrEncryptor(secret_key_.get(), *salt);
if (!encryptor) {
NL_LOG(ERROR) << "Encryption failed: Could not create CTR encryptor.";
LOG(ERROR) << "Encryption failed: Could not create CTR encryptor.";
return std::nullopt;
}
NL_DCHECK_EQ(kNearbyShareNumBytesMetadataEncryptionKey,
metadata_encryption_key_.size());
DCHECK_EQ(kNearbyShareNumBytesMetadataEncryptionKey,
metadata_encryption_key_.size());
std::vector<uint8_t> encrypted_metadata_key;
if (!encryptor->Encrypt(metadata_encryption_key_, &encrypted_metadata_key)) {
NL_LOG(ERROR) << "Encryption failed: Could not encrypt metadata key.";
LOG(ERROR) << "Encryption failed: Could not encrypt metadata key.";
return std::nullopt;
}
@@ -250,7 +248,7 @@ std::optional<std::vector<uint8_t>> NearbySharePrivateCertificate::Sign(
std::vector<uint8_t> signature;
if (!signer->Sign(payload, &signature)) {
NL_LOG(ERROR) << "Signing failed.";
LOG(ERROR) << "Signing failed.";
return std::nullopt;
}
@@ -267,21 +265,21 @@ std::optional<nearby::sharing::proto::PublicCertificate>
NearbySharePrivateCertificate::ToPublicCertificate() const {
std::vector<uint8_t> public_key;
if (!key_pair_->ExportPublicKey(&public_key)) {
NL_LOG(ERROR) << "Failed to export public key.";
LOG(ERROR) << "Failed to export public key.";
return std::nullopt;
}
std::optional<std::vector<uint8_t>> encrypted_metadata_bytes =
EncryptMetadata();
if (!encrypted_metadata_bytes) {
NL_LOG(ERROR) << "Failed to encrypt metadata.";
LOG(ERROR) << "Failed to encrypt metadata.";
return std::nullopt;
}
std::optional<std::vector<uint8_t>> metadata_encryption_key_tag =
CreateMetadataEncryptionKeyTag(metadata_encryption_key_);
if (!metadata_encryption_key_tag) {
NL_LOG(ERROR) << "Failed to compute metadata encryption key tag.";
LOG(ERROR) << "Failed to compute metadata encryption key tag.";
return std::nullopt;
}
@@ -367,7 +365,7 @@ NearbySharePrivateCertificate::FromCertificateData(
std::optional<std::vector<uint8_t>>
NearbySharePrivateCertificate::GenerateUnusedSalt() {
if (consumed_salts_.size() >= kNearbyShareMaxNumMetadataEncryptionKeySalts) {
NL_LOG(ERROR) << "All salts exhausted for certificate.";
LOG(ERROR) << "All salts exhausted for certificate.";
return std::nullopt;
}
@@ -381,7 +379,7 @@ NearbySharePrivateCertificate::GenerateUnusedSalt() {
salt = next_salts_for_testing_.front();
next_salts_for_testing_.pop();
}
NL_DCHECK_EQ(2u, salt.size());
DCHECK_EQ(2u, salt.size());
if (consumed_salts_.find(salt) == consumed_salts_.end()) {
consumed_salts_.insert(salt);
@@ -389,8 +387,8 @@ NearbySharePrivateCertificate::GenerateUnusedSalt() {
}
}
NL_LOG(ERROR) << "Salt generation exceeded max number of retries. This is "
"highly improbable.";
LOG(ERROR) << "Salt generation exceeded max number of retries. This is "
"highly improbable.";
return std::nullopt;
}
@@ -72,7 +72,7 @@ FakeNearbyFastInitiation::Factory::CreateInstance(Context* context) {
FakeNearbyFastInitiation::FakeNearbyFastInitiation(Context* context)
: context_(context) {
NL_DCHECK(context_);
DCHECK(context_);
}
bool FakeNearbyFastInitiation::IsLowEnergySupported() {
@@ -35,7 +35,7 @@ NearbyFastInitiationImpl::Factory*
std::unique_ptr<NearbyFastInitiation> NearbyFastInitiationImpl::Factory::Create(
Context* context) {
NL_DCHECK(context);
DCHECK(context);
if (test_factory_) {
return test_factory_->CreateInstance(context);
}
@@ -50,7 +50,7 @@ void NearbyFastInitiationImpl::Factory::SetFactoryForTesting(
NearbyFastInitiationImpl::NearbyFastInitiationImpl(Context* context)
: context_(context) {
NL_DCHECK(context);
DCHECK(context);
}
bool NearbyFastInitiationImpl::IsLowEnergySupported() {
@@ -78,8 +78,7 @@ void NearbyFastInitiationImpl::StartScanning(
std::function<void()> devices_not_discovered_callback,
std::function<void()> error_callback) {
if (IsScanning()) {
NL_LOG(WARNING) << __func__
<< ": FastInit BLE scanning was started already.";
LOG(WARNING) << __func__ << ": FastInit BLE scanning was started already.";
error_callback();
return;
}
@@ -96,7 +95,7 @@ void NearbyFastInitiationImpl::StartScanning(
void NearbyFastInitiationImpl::StopScanning(std::function<void()> callback) {
if (!IsScanning()) {
NL_LOG(WARNING) << __func__ << ": FastInit BLE scanning is not running.";
LOG(WARNING) << __func__ << ": FastInit BLE scanning is not running.";
callback();
return;
}
@@ -108,8 +107,8 @@ void NearbyFastInitiationImpl::StartAdvertising(
FastInitType type, std::function<void()> callback,
std::function<void()> error_callback) {
if (IsAdvertising()) {
NL_LOG(WARNING) << __func__
<< ": FastInit BLE advertising was started already.";
LOG(WARNING) << __func__
<< ": FastInit BLE advertising was started already.";
error_callback();
return;
}
@@ -126,7 +125,7 @@ void NearbyFastInitiationImpl::StartAdvertising(
void NearbyFastInitiationImpl::StopAdvertising(std::function<void()> callback) {
if (!IsAdvertising()) {
NL_LOG(WARNING) << __func__ << ": FastInit BLE advertising is not running.";
LOG(WARNING) << __func__ << ": FastInit BLE advertising is not running.";
callback();
return;
}
@@ -144,9 +143,9 @@ void NearbyFastInitiationImpl::ScanningErrorCodeCallbackHandler(
observer->HardwareErrorReported(this);
}
}
NL_LOG(ERROR) << __func__
<< ": FastInit BLE scanning failed due to bluetooth radio "
"unavailable.";
LOG(ERROR) << __func__
<< ": FastInit BLE scanning failed due to bluetooth radio "
"unavailable.";
break;
case FastInitiationManager::Error::kResourceInUse:
for (Observer* observer : observer_list_.GetObservers()) {
@@ -154,18 +153,18 @@ void NearbyFastInitiationImpl::ScanningErrorCodeCallbackHandler(
observer->HardwareErrorReported(this);
}
}
NL_LOG(ERROR)
LOG(ERROR)
<< __func__
<< ": FastInit BLE scanning failed due to bluetooth resources are "
"in use/at full capacity.";
break;
case FastInitiationManager::Error::kDisabledByPolicy:
NL_LOG(ERROR)
LOG(ERROR)
<< __func__
<< ": FastInit BLE scanning failed due to being disabled by policy.";
break;
case FastInitiationManager::Error::kDisabledByUser:
NL_LOG(ERROR)
LOG(ERROR)
<< __func__
<< ": FastInit BLE scanning failed due to being disabled by user.";
break;
@@ -175,7 +174,7 @@ void NearbyFastInitiationImpl::ScanningErrorCodeCallbackHandler(
observer->HardwareErrorReported(this);
}
}
NL_LOG(ERROR)
LOG(ERROR)
<< __func__
<< ": FastInit BLE scanning failed due to hardware not supported.";
break;
@@ -185,14 +184,13 @@ void NearbyFastInitiationImpl::ScanningErrorCodeCallbackHandler(
observer->HardwareErrorReported(this);
}
}
NL_LOG(ERROR)
LOG(ERROR)
<< __func__
<< ": FastInit BLE scanning failed due to transport not supported.";
break;
case FastInitiationManager::Error::kConsentRequired:
NL_LOG(ERROR)
<< __func__
<< ": FastInit BLE scanning failed due to consent required.";
LOG(ERROR) << __func__
<< ": FastInit BLE scanning failed due to consent required.";
break;
case FastInitiationManager::Error::kUnknown:
for (Observer* observer : observer_list_.GetObservers()) {
@@ -200,8 +198,8 @@ void NearbyFastInitiationImpl::ScanningErrorCodeCallbackHandler(
observer->HardwareErrorReported(this);
}
}
NL_LOG(ERROR) << __func__
<< ": FastInit BLE scanning failed due to unknown reasons.";
LOG(ERROR) << __func__
<< ": FastInit BLE scanning failed due to unknown reasons.";
break;
default:
break;
@@ -217,10 +215,9 @@ void NearbyFastInitiationImpl::AdvertisingErrorCodeCallbackHandler(
observer->HardwareErrorReported(this);
}
}
NL_LOG(ERROR)
<< __func__
<< ": FastInit BLE advertising failed due to bluetooth radio "
"unavailable.";
LOG(ERROR) << __func__
<< ": FastInit BLE advertising failed due to bluetooth radio "
"unavailable.";
break;
case FastInitiationManager::Error::kResourceInUse:
for (Observer* observer : observer_list_.GetObservers()) {
@@ -228,18 +225,18 @@ void NearbyFastInitiationImpl::AdvertisingErrorCodeCallbackHandler(
observer->HardwareErrorReported(this);
}
}
NL_LOG(ERROR)
LOG(ERROR)
<< __func__
<< ": FastInit BLE advertising failed due to bluetooth resources are "
"in use/at full capacity.";
break;
case FastInitiationManager::Error::kDisabledByPolicy:
NL_LOG(ERROR) << __func__
<< ": FastInit BLE advertising failed due to being "
"disabled by policy.";
LOG(ERROR) << __func__
<< ": FastInit BLE advertising failed due to being "
"disabled by policy.";
break;
case FastInitiationManager::Error::kDisabledByUser:
NL_LOG(ERROR)
LOG(ERROR)
<< __func__
<< ": FastInit BLE advertising failed due to being disabled by user.";
break;
@@ -249,7 +246,7 @@ void NearbyFastInitiationImpl::AdvertisingErrorCodeCallbackHandler(
observer->HardwareErrorReported(this);
}
}
NL_LOG(ERROR)
LOG(ERROR)
<< __func__
<< ": FastInit BLE advertising failed due to hardware not supported.";
break;
@@ -259,12 +256,12 @@ void NearbyFastInitiationImpl::AdvertisingErrorCodeCallbackHandler(
observer->HardwareErrorReported(this);
}
}
NL_LOG(ERROR) << __func__
<< ": FastInit BLE advertising failed due to transport not "
"supported.";
LOG(ERROR) << __func__
<< ": FastInit BLE advertising failed due to transport not "
"supported.";
break;
case FastInitiationManager::Error::kConsentRequired:
NL_LOG(ERROR)
LOG(ERROR)
<< __func__
<< ": FastInit BLE advertising failed due to consent required.";
break;
@@ -274,9 +271,8 @@ void NearbyFastInitiationImpl::AdvertisingErrorCodeCallbackHandler(
observer->HardwareErrorReported(this);
}
}
NL_LOG(ERROR)
<< __func__
<< ": FastInit BLE advertising failed due to unknown reasons.";
LOG(ERROR) << __func__
<< ": FastInit BLE advertising failed due to unknown reasons.";
break;
default:
break;
@@ -285,11 +281,11 @@ void NearbyFastInitiationImpl::AdvertisingErrorCodeCallbackHandler(
void NearbyFastInitiationImpl::AddObserver(Observer* observer) {
observer_list_.AddObserver(observer);
NL_LOG(INFO) << __func__ << ": Fast Initiation observer added.";
LOG(INFO) << __func__ << ": Fast Initiation observer added.";
}
void NearbyFastInitiationImpl::RemoveObserver(Observer* observer) {
observer_list_.RemoveObserver(observer);
NL_LOG(INFO) << __func__ << ": Fast Initiation observer removed.";
LOG(INFO) << __func__ << ": Fast Initiation observer removed.";
}
bool NearbyFastInitiationImpl::HasObserver(Observer* observer) {
return observer_list_.HasObserver(observer);
+14 -14
View File
@@ -58,11 +58,11 @@ IncomingFramesReader::IncomingFramesReader(TaskRunner& service_thread,
NearbyConnection* connection)
: service_thread_(service_thread),
connection_(connection) {
NL_DCHECK(connection);
DCHECK(connection);
}
IncomingFramesReader::~IncomingFramesReader() {
NL_LOG(INFO) << "~IncomingFramesReader is called";
LOG(INFO) << "~IncomingFramesReader is called";
CloseAllPendingReads();
}
@@ -110,8 +110,8 @@ void IncomingFramesReader::ProcessReadRequest(
[reader = GetWeakPtr()]() {
auto frame_reader = reader.lock();
if (frame_reader == nullptr) {
NL_LOG(WARNING) << "IncomingFramesReader has already been released "
"before read timeout.";
LOG(WARNING) << "IncomingFramesReader has already been released "
"before read timeout.";
return;
}
frame_reader->OnTimeout();
@@ -126,11 +126,11 @@ void IncomingFramesReader::ReadNextFrame() {
[reader = GetWeakPtr()](std::optional<std::vector<uint8_t>> bytes) {
auto frame_reader = reader.lock();
if (frame_reader == nullptr) {
NL_LOG(WARNING) << "IncomingFramesReader is released before.";
LOG(WARNING) << "IncomingFramesReader is released before.";
return;
}
if (!bytes.has_value()) {
NL_LOG(WARNING) << __func__ << ": Failed to read frame";
LOG(WARNING) << __func__ << ": Failed to read frame";
frame_reader->CloseAllPendingReads();
return;
}
@@ -139,7 +139,7 @@ void IncomingFramesReader::ReadNextFrame() {
}
void IncomingFramesReader::OnTimeout() {
NL_LOG(WARNING) << __func__ << ": Timed out reading from NearbyConnection.";
LOG(WARNING) << __func__ << ": Timed out reading from NearbyConnection.";
CloseAllPendingReads();
}
@@ -147,7 +147,7 @@ void IncomingFramesReader::OnDataReadFromConnection(
const std::vector<uint8_t>& bytes) {
std::unique_ptr<V1Frame> frame = DecodeV1Frame(bytes);
if (frame == nullptr) {
NL_LOG(WARNING)
LOG(WARNING)
<< __func__
<< ": Cannot decode frame. Not currently bound to nearby process";
ReadNextFrame();
@@ -163,9 +163,9 @@ void IncomingFramesReader::OnDataReadFromConnection(
const ReadFrameInfo& frame_info = read_frame_info_queue_.front();
if (frame_info.frame_type.has_value() &&
*frame_info.frame_type != frame_type) {
NL_LOG(WARNING) << __func__ << ": Failed to read frame of type "
<< *frame_info.frame_type << ", but got frame of type "
<< frame_type << ". Cached for later.";
LOG(WARNING) << __func__ << ": Failed to read frame of type "
<< *frame_info.frame_type << ", but got frame of type "
<< frame_type << ". Cached for later.";
cached_frames_.push_back(std::move(frame));
cached_frame = true;
}
@@ -219,7 +219,7 @@ void IncomingFramesReader::Done(std::unique_ptr<V1Frame> frame) {
std::unique_ptr<V1Frame> IncomingFramesReader::PopCachedFrame(
std::optional<V1Frame::FrameType> frame_type) {
NL_VLOG(1) << __func__ << ": Fetching cached frame";
VLOG(1) << __func__ << ": Fetching cached frame";
if (cached_frames_.empty()) {
return nullptr;
}
@@ -228,7 +228,7 @@ std::unique_ptr<V1Frame> IncomingFramesReader::PopCachedFrame(
cached_frames_.pop_front();
return frame;
}
NL_VLOG(1) << __func__ << ": Requested frame type - " << *frame_type;
VLOG(1) << __func__ << ": Requested frame type - " << *frame_type;
auto iter =
std::find_if(cached_frames_.begin(), cached_frames_.end(),
@@ -237,7 +237,7 @@ std::unique_ptr<V1Frame> IncomingFramesReader::PopCachedFrame(
});
if (iter == cached_frames_.end()) return nullptr;
NL_VLOG(1) << __func__ << ": Successfully read cached frame";
VLOG(1) << __func__ << ": Successfully read cached frame";
std::unique_ptr<V1Frame> frame = std::move(*iter);
cached_frames_.erase(iter);
return frame;
-19
View File
@@ -32,23 +32,4 @@
#define NL_VLOG(level) VLOG(level)
#define NL_LOG(severity) LOG(severity)
#define NL_DLOG(severity) DLOG(severity)
#define NL_DVLOG(severity) DVLOG(severity)
#define NL_CHECK(expr) CHECK(expr)
#define NL_CHECK_EQ(a, b) CHECK_EQ((a), (b))
#define NL_CHECK_NE(a, b) CHECK_NE((a), (b))
#define NL_CHECK_GE(a, b) CHECK_GE((a), (b))
#define NL_CHECK_GT(a, b) CHECK_GT((a), (b))
#define NL_CHECK_LE(a, b) CHECK_LE((a), (b))
#define NL_CHECK_LT(a, b) CHECK_LT((a), (b))
#define NL_DCHECK(expr) DCHECK((expr))
#define NL_DCHECK_EQ(a, b) DCHECK_EQ((a), (b))
#define NL_DCHECK_NE(a, b) DCHECK_NE((a), (b))
#define NL_DCHECK_GE(a, b) DCHECK_GE((a), (b))
#define NL_DCHECK_GT(a, b) DCHECK_GT((a), (b))
#define NL_DCHECK_LE(a, b) DCHECK_LE((a), (b))
#define NL_DCHECK_LT(a, b) DCHECK_LT((a), (b))
#endif // THIRD_PARTY_NEARBY_SHARING_INTERNAL_PUBLIC_LOGGING_H_
@@ -41,7 +41,7 @@ NearbyConnectionsStreamBufferManager::~NearbyConnectionsStreamBufferManager() =
void NearbyConnectionsStreamBufferManager::StartTrackingPayload(
NcPayload payload) {
int64_t payload_id = payload.GetId();
NL_LOG(INFO) << "Starting to track stream payload with ID " << payload_id;
LOG(INFO) << "Starting to track stream payload with ID " << payload_id;
id_to_payload_with_buffer_map_[payload_id] =
std::make_unique<PayloadWithBuffer>(std::move(payload));
@@ -55,7 +55,7 @@ bool NearbyConnectionsStreamBufferManager::IsTrackingPayload(
void NearbyConnectionsStreamBufferManager::StopTrackingFailedPayload(
int64_t payload_id) {
id_to_payload_with_buffer_map_.erase(payload_id);
NL_LOG(INFO) << "Stopped tracking payload with ID " << payload_id << " "
LOG(INFO) << "Stopped tracking payload with ID " << payload_id << " "
<< "and cleared internal memory.";
}
@@ -63,7 +63,7 @@ void NearbyConnectionsStreamBufferManager::HandleBytesTransferred(
int64_t payload_id, int64_t cumulative_bytes_transferred_so_far) {
auto it = id_to_payload_with_buffer_map_.find(payload_id);
if (it == id_to_payload_with_buffer_map_.end()) {
NL_LOG(ERROR) << "Attempted to handle stream bytes for payload with ID "
LOG(ERROR) << "Attempted to handle stream bytes for payload with ID "
<< payload_id << ", but this payload was not being tracked.";
return;
}
@@ -77,7 +77,7 @@ void NearbyConnectionsStreamBufferManager::HandleBytesTransferred(
NcInputStream* stream = payload_with_buffer->buffer_payload.AsStream();
if (!stream) {
NL_LOG(ERROR) << "Payload with ID " << payload_id << " is not a stream "
LOG(ERROR) << "Payload with ID " << payload_id << " is not a stream "
<< "payload; transfer has failed.";
StopTrackingFailedPayload(payload_id);
return;
@@ -85,7 +85,7 @@ void NearbyConnectionsStreamBufferManager::HandleBytesTransferred(
NcExceptionOr<NcByteArray> bytes = stream->Read(bytes_to_read);
if (!bytes.ok()) {
NL_LOG(ERROR) << "Payload with ID " << payload_id << " encountered "
LOG(ERROR) << "Payload with ID " << payload_id << " encountered "
<< "exception while reading; transfer has failed.";
StopTrackingFailedPayload(payload_id);
return;
@@ -93,7 +93,7 @@ void NearbyConnectionsStreamBufferManager::HandleBytesTransferred(
// Empty `bytes` means the End Of File. There should be at `bytes_to_read`
// bytes available in the input stream, so we should never face the EOF
// condition.
NL_DCHECK(!bytes.result().Empty());
DCHECK(!bytes.result().Empty());
payload_with_buffer->buffer += static_cast<std::string>(bytes.result());
}
@@ -103,8 +103,8 @@ NearbyConnectionsStreamBufferManager::GetCompletePayloadAndStopTracking(
int64_t payload_id) {
auto it = id_to_payload_with_buffer_map_.find(payload_id);
if (it == id_to_payload_with_buffer_map_.end()) {
NL_LOG(ERROR) << "Attempted to get complete payload with ID " << payload_id
<< ", but this payload was not being tracked.";
LOG(ERROR) << "Attempted to get complete payload with ID " << payload_id
<< ", but this payload was not being tracked.";
return NcByteArray();
}
@@ -68,7 +68,7 @@ void FakeNearbyShareScheduler::OnStop() {
}
void FakeNearbyShareScheduler::InvokeRequestCallback() {
NL_DCHECK(can_invoke_request_callback_);
DCHECK(can_invoke_request_callback_);
NotifyOfRequest();
}
@@ -92,8 +92,8 @@ void NearbyShareSchedulerBase::HandleResult(bool success) {
absl::Time now = clock_->Now();
SetLastAttemptTime(now);
NL_LOG(INFO) << "Nearby Share scheduler \"" << pref_name_
<< "\" latest attempt " << (success ? "succeeded" : "failed");
LOG(INFO) << "Nearby Share scheduler \"" << pref_name_ << "\" latest attempt "
<< (success ? "succeeded" : "failed");
if (success) {
SetLastSuccessTime(now);
@@ -165,8 +165,8 @@ bool NearbyShareSchedulerBase::IsWaitingForResult() const {
// This will speed up the data sync when there are issues.
if (!is_initialized_) {
if (GetNumConsecutiveFailures() > 0) {
NL_LOG(WARNING) << ": Run the scheduler " << pref_name_
<< " immediately due to having failed runs.";
LOG(WARNING) << ": Run the scheduler " << pref_name_
<< " immediately due to having failed runs.";
return true;
}
}
@@ -187,7 +187,7 @@ size_t NearbyShareSchedulerBase::GetNumConsecutiveFailures() const {
void NearbyShareSchedulerBase::OnStart() {
Reschedule();
NL_LOG(INFO) << "Starting Nearby Share scheduler \"" << pref_name_ << "\"";
LOG(INFO) << "Starting Nearby Share scheduler \"" << pref_name_ << "\"";
PrintSchedulerState();
}
@@ -283,7 +283,7 @@ std::optional<absl::Duration> NearbyShareSchedulerBase::TimeUntilRetry(
}
void NearbyShareSchedulerBase::OnTimerFired() {
NL_DCHECK(is_running());
DCHECK(is_running());
if (require_connectivity_ &&
(connectivity_manager_->GetConnectionType() ==
nearby::ConnectivityManager::ConnectionType::kNone)) {
@@ -333,7 +333,7 @@ void NearbyShareSchedulerBase::PrintSchedulerState() const {
<< (HasPendingImmediateRequest() ? "Yes" : "No");
ss << "\n Num consecutive failures: " << GetNumConsecutiveFailures();
NL_VLOG(1) << ss.str();
VLOG(1) << ss.str();
}
} // namespace sharing