Apply OWS log functions in Objective-C.

This commit is contained in:
Matthew Chen 2018-08-27 12:58:35 -04:00
parent f473f60111
commit 9477606732
7 changed files with 25 additions and 25 deletions

View File

@ -131,7 +131,7 @@ NS_ASSUME_NONNULL_BEGIN
OWSProdInfo([OWSAnalyticsEvents registrationRegisteringSubmittedCode]);
[[OWS2FAManager sharedManager] mark2FAAsEnabledWithPin:pinCode];
OWSLogInfo(@"%@ Successfully registered Signal account.", weakSelf.logTag);
OWSLogInfo(@"Successfully registered Signal account.");
dispatch_async(dispatch_get_main_queue(), ^{
[modalActivityIndicator dismissWithCompletion:^{
OWSAssertIsOnMainThread();
@ -143,7 +143,7 @@ NS_ASSUME_NONNULL_BEGIN
.catch(^(NSError *error) {
OWSAssertIsOnMainThread();
OWSProdInfo([OWSAnalyticsEvents registrationRegistrationFailed]);
OWSLogError(@"%@ error verifying challenge: %@", weakSelf.logTag, error);
OWSLogError(@"error verifying challenge: %@", error);
dispatch_async(dispatch_get_main_queue(), ^{
[modalActivityIndicator dismissWithCompletion:^{
OWSAssertIsOnMainThread();

View File

@ -285,16 +285,16 @@ NS_ASSUME_NONNULL_BEGIN
.then(^{
OWSProdInfo([OWSAnalyticsEvents registrationRegisteringSubmittedCode]);
OWSLogInfo(@"%@ Successfully registered Signal account.", weakSelf.logTag);
OWSLogInfo(@"Successfully registered Signal account.");
dispatch_async(dispatch_get_main_queue(), ^{
[weakSelf stopActivityIndicator];
[weakSelf verificationWasCompleted];
});
})
.catch(^(NSError *error) {
OWSLogError(@"%@ error: %@, %@, %zd", weakSelf.logTag, [error class], error.domain, error.code);
OWSLogError(@"error: %@, %@, %zd", [error class], error.domain, error.code);
OWSProdInfo([OWSAnalyticsEvents registrationRegistrationFailed]);
OWSLogError(@"%@ error verifying challenge: %@", weakSelf.logTag, error);
OWSLogError(@"error verifying challenge: %@", error);
dispatch_async(dispatch_get_main_queue(), ^{
[weakSelf stopActivityIndicator];
@ -304,7 +304,7 @@ NS_ASSUME_NONNULL_BEGIN
if (!strongSelf) {
return;
}
OWSLogInfo(@"%@ Showing 2FA registration view.", strongSelf.logTag);
OWSLogInfo(@"Showing 2FA registration view.");
OWS2FARegistrationViewController *viewController = [OWS2FARegistrationViewController new];
viewController.verificationCode = strongSelf.validationCodeFromTextField;
[strongSelf.navigationController pushViewController:viewController animated:YES];
@ -354,12 +354,12 @@ NS_ASSUME_NONNULL_BEGIN
__weak CodeVerificationViewController *weakSelf = self;
[TSAccountManager
rerequestSMSWithSuccess:^{
OWSLogInfo(@"%@ Successfully requested SMS code", weakSelf.logTag);
OWSLogInfo(@"Successfully requested SMS code");
[weakSelf enableServerActions:YES];
[weakSelf.requestCodeAgainSpinner stopAnimating];
}
failure:^(NSError *error) {
OWSLogError(@"%@ Failed to request SMS code with error: %@", weakSelf.logTag, error);
OWSLogError(@"Failed to request SMS code with error: %@", error);
[weakSelf showRegistrationErrorMessage:error];
[weakSelf enableServerActions:YES];
[weakSelf.requestCodeAgainSpinner stopAnimating];
@ -377,13 +377,13 @@ NS_ASSUME_NONNULL_BEGIN
__weak CodeVerificationViewController *weakSelf = self;
[TSAccountManager
rerequestVoiceWithSuccess:^{
OWSLogInfo(@"%@ Successfully requested voice code", weakSelf.logTag);
OWSLogInfo(@"Successfully requested voice code");
[weakSelf enableServerActions:YES];
[weakSelf.requestCallSpinner stopAnimating];
}
failure:^(NSError *error) {
OWSLogError(@"%@ Failed to request voice code with error: %@", weakSelf.logTag, error);
OWSLogError(@"Failed to request voice code with error: %@", error);
[weakSelf showRegistrationErrorMessage:error];
[weakSelf enableServerActions:YES];
[weakSelf.requestCallSpinner stopAnimating];

View File

@ -715,7 +715,7 @@ NS_ASSUME_NONNULL_BEGIN
// Ensure that we continue to work off the main thread.
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
// Database files are critical so any error uploading them is unrecoverable.
OWSLogVerbose(@"%@ error while saving file: %@", weakSelf.logTag, item.encryptedItem.filePath);
OWSLogVerbose(@"error while saving file: %@", item.encryptedItem.filePath);
completion(error);
});
}];

View File

@ -178,7 +178,7 @@ NSString *const kOWSBackup_KeychainService = @"kOWSBackup_KeychainService";
failure:^(NSError *error) {
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
// The manifest file is critical so any error downloading it is unrecoverable.
OWSCFailDebug(@"%@ Could not download manifest.", weakSelf.logTag);
OWSCFailDebug(@"Could not download manifest.");
failure(error);
});
}];

View File

@ -86,21 +86,21 @@ typedef void (^DebugLogUploadFailure)(DebugLogUploader *uploader, NSError *error
}
if (![responseObject isKindOfClass:[NSDictionary class]]) {
OWSLogError(@"%@ Invalid response: %@, %@", strongSelf.logTag, urlString, responseObject);
OWSLogError(@"Invalid response: %@, %@", urlString, responseObject);
[strongSelf
failWithError:OWSErrorWithCodeDescription(OWSErrorCodeDebugLogUploadFailed, @"Invalid response")];
return;
}
NSString *uploadUrl = responseObject[@"url"];
if (![uploadUrl isKindOfClass:[NSString class]] || uploadUrl.length < 1) {
OWSLogError(@"%@ Invalid response: %@, %@", strongSelf.logTag, urlString, responseObject);
OWSLogError(@"Invalid response: %@, %@", urlString, responseObject);
[strongSelf
failWithError:OWSErrorWithCodeDescription(OWSErrorCodeDebugLogUploadFailed, @"Invalid response")];
return;
}
NSDictionary *fields = responseObject[@"fields"];
if (![fields isKindOfClass:[NSDictionary class]] || fields.count < 1) {
OWSLogError(@"%@ Invalid response: %@, %@", strongSelf.logTag, urlString, responseObject);
OWSLogError(@"Invalid response: %@, %@", urlString, responseObject);
[strongSelf
failWithError:OWSErrorWithCodeDescription(OWSErrorCodeDebugLogUploadFailed, @"Invalid response")];
return;
@ -109,7 +109,7 @@ typedef void (^DebugLogUploadFailure)(DebugLogUploader *uploader, NSError *error
NSString *fieldValue = fields[fieldName];
if (![fieldName isKindOfClass:[NSString class]] || fieldName.length < 1
|| ![fieldValue isKindOfClass:[NSString class]] || fieldValue.length < 1) {
OWSLogError(@"%@ Invalid response: %@, %@", strongSelf.logTag, urlString, responseObject);
OWSLogError(@"Invalid response: %@, %@", urlString, responseObject);
[strongSelf failWithError:OWSErrorWithCodeDescription(
OWSErrorCodeDebugLogUploadFailed, @"Invalid response")];
return;
@ -117,7 +117,7 @@ typedef void (^DebugLogUploadFailure)(DebugLogUploader *uploader, NSError *error
}
NSString *_Nullable uploadKey = fields[@"key"];
if (![uploadKey isKindOfClass:[NSString class]] || uploadKey.length < 1) {
OWSLogError(@"%@ Invalid response: %@, %@", strongSelf.logTag, urlString, responseObject);
OWSLogError(@"Invalid response: %@, %@", urlString, responseObject);
[strongSelf
failWithError:OWSErrorWithCodeDescription(OWSErrorCodeDebugLogUploadFailed, @"Invalid response")];
return;
@ -126,7 +126,7 @@ typedef void (^DebugLogUploadFailure)(DebugLogUploader *uploader, NSError *error
// Add a file extension to the upload's key.
NSString *fileExtension = strongSelf.fileUrl.lastPathComponent.pathExtension;
if (fileExtension.length < 1) {
OWSLogError(@"%@ Invalid file url: %@, %@", strongSelf.logTag, urlString, responseObject);
OWSLogError(@"Invalid file url: %@, %@", urlString, responseObject);
[strongSelf
failWithError:OWSErrorWithCodeDescription(OWSErrorCodeDebugLogUploadFailed, @"Invalid file url")];
return;
@ -138,7 +138,7 @@ typedef void (^DebugLogUploadFailure)(DebugLogUploader *uploader, NSError *error
[strongSelf uploadFileWithUploadUrl:uploadUrl fields:updatedFields uploadKey:uploadKey];
}
failure:^(NSURLSessionDataTask *_Nullable task, NSError *error) {
OWSLogError(@"%@ failed: %@", weakSelf.logTag, urlString);
OWSLogError(@"failed: %@", urlString);
[weakSelf failWithError:error];
}];
}
@ -172,18 +172,18 @@ typedef void (^DebugLogUploadFailure)(DebugLogUploader *uploader, NSError *error
mimeType:weakSelf.mimeType
error:&error];
if (!success || error) {
OWSLogError(@"%@ failed: %@, error: %@", weakSelf.logTag, uploadUrl, error);
OWSLogError(@"failed: %@, error: %@", uploadUrl, error);
}
}
progress:nil
success:^(NSURLSessionDataTask *task, id _Nullable responseObject) {
OWSLogVerbose(@"%@ Response: %@, %@", weakSelf.logTag, uploadUrl, responseObject);
OWSLogVerbose(@"Response: %@, %@", uploadUrl, responseObject);
NSString *urlString = [NSString stringWithFormat:@"https://debuglogs.org/%@", uploadKey];
[self succeedWithUrl:[NSURL URLWithString:urlString]];
}
failure:^(NSURLSessionDataTask *_Nullable task, NSError *error) {
OWSLogError(@"%@ upload: %@ failed with error: %@", weakSelf.logTag, uploadUrl, error);
OWSLogError(@"upload: %@ failed with error: %@", uploadUrl, error);
[weakSelf failWithError:error];
}];
}

View File

@ -379,7 +379,7 @@ NSString *NSStringForOutgoingMessageRecipientState(OWSOutgoingMessageRecipientSt
TSAttachment *_Nullable attachment =
[TSAttachment fetchObjectWithUniqueID:attachmentId transaction:transaction];
if (!attachment) {
OWSLogError(@"%@ couldn't load interaction's attachment for deletion.", TSOutgoingMessage.logTag);
OWSLogError(@"Couldn't load interaction's attachment for deletion.");
continue;
}
[attachment removeWithTransaction:transaction];

View File

@ -363,7 +363,7 @@ typedef NSNumber *OWSTaskId;
if (!strongSelf) {
return;
}
OWSLogVerbose(@"%@ task expired", strongSelf.logTag);
OWSLogVerbose(@"task expired");
// Make a local copy of completionBlock to ensure that it is called
// exactly once.
@ -374,7 +374,7 @@ typedef NSNumber *OWSTaskId;
if (!strongSelf.taskId) {
return;
}
OWSLogInfo(@"%@ %@ background task expired.", strongSelf.logTag, strongSelf.label);
OWSLogInfo(@"%@ background task expired.", strongSelf.label);
strongSelf.taskId = nil;
completionBlock = strongSelf.completionBlock;