Apply OWS log functions in Objective-C.

pull/1/head
Matthew Chen 7 years ago
parent c0d486b1f1
commit 03829779cc

@ -335,12 +335,12 @@ const CGFloat kRemotelySourcedContentRowSpacing = 3;
OWSLogDebug(@"%@ in didTapFailedThumbnailDownload", self.logTag); OWSLogDebug(@"%@ in didTapFailedThumbnailDownload", self.logTag);
if (!self.quotedMessage.thumbnailDownloadFailed) { if (!self.quotedMessage.thumbnailDownloadFailed) {
OWSFailDebug(@"%@ in %s thumbnailDownloadFailed was unexpectedly false", self.logTag, __PRETTY_FUNCTION__); OWSFailDebug(@"thumbnailDownloadFailed was unexpectedly false");
return; return;
} }
if (!self.quotedMessage.thumbnailAttachmentPointer) { if (!self.quotedMessage.thumbnailAttachmentPointer) {
OWSFailDebug(@"%@ in %s thumbnailAttachmentPointer was unexpectedly nil", self.logTag, __PRETTY_FUNCTION__); OWSFailDebug(@"thumbnailAttachmentPointer was unexpectedly nil");
return; return;
} }

@ -592,13 +592,13 @@ typedef enum : NSUInteger {
- (BOOL)becomeFirstResponder - (BOOL)becomeFirstResponder
{ {
OWSLogDebug(@"%@ in %s", self.logTag, __PRETTY_FUNCTION__); OWSLogDebug(@"");
return [super becomeFirstResponder]; return [super becomeFirstResponder];
} }
- (BOOL)resignFirstResponder - (BOOL)resignFirstResponder
{ {
OWSLogDebug(@"%@ in %s", self.logTag, __PRETTY_FUNCTION__); OWSLogDebug(@"");
return [super resignFirstResponder]; return [super resignFirstResponder];
} }
@ -2317,7 +2317,7 @@ typedef enum : NSUInteger {
TSMessage *message = (TSMessage *)viewItem.interaction; TSMessage *message = (TSMessage *)viewItem.interaction;
if (![message isKindOfClass:[TSMessage class]]) { if (![message isKindOfClass:[TSMessage class]]) {
OWSFailDebug(@"%@ in %s message had unexpected class: %@", self.logTag, __PRETTY_FUNCTION__, message.class); OWSFailDebug(@"message had unexpected class: %@", message.class);
return; return;
} }
@ -5225,13 +5225,13 @@ typedef enum : NSUInteger {
- (void)contactsPickerDidCancel:(ContactsPicker *)contactsPicker - (void)contactsPickerDidCancel:(ContactsPicker *)contactsPicker
{ {
OWSLogDebug(@"%@ in %s", self.logTag, __PRETTY_FUNCTION__); OWSLogDebug(@"");
[self dismissViewControllerAnimated:YES completion:nil]; [self dismissViewControllerAnimated:YES completion:nil];
} }
- (void)contactsPicker:(ContactsPicker *)contactsPicker contactFetchDidFail:(NSError *)error - (void)contactsPicker:(ContactsPicker *)contactsPicker contactFetchDidFail:(NSError *)error
{ {
OWSLogDebug(@"%@ in %s with error %@", self.logTag, __PRETTY_FUNCTION__, error); OWSLogDebug(@"with error %@", error);
[self dismissViewControllerAnimated:YES completion:nil]; [self dismissViewControllerAnimated:YES completion:nil];
} }
@ -5245,7 +5245,7 @@ typedef enum : NSUInteger {
return; return;
} }
OWSLogDebug(@"%@ in %s with contact: %@", self.logTag, __PRETTY_FUNCTION__, contact); OWSLogDebug(@"with contact: %@", contact);
OWSContact *_Nullable contactShareRecord = [OWSContacts contactForSystemContact:cnContact]; OWSContact *_Nullable contactShareRecord = [OWSContacts contactForSystemContact:cnContact];
if (!contactShareRecord) { if (!contactShareRecord) {
@ -5280,7 +5280,7 @@ typedef enum : NSUInteger {
- (void)contactsPicker:(ContactsPicker *)contactsPicker didSelectMultipleContacts:(NSArray<Contact *> *)contacts - (void)contactsPicker:(ContactsPicker *)contactsPicker didSelectMultipleContacts:(NSArray<Contact *> *)contacts
{ {
OWSFailDebug(@"%@ in %s with contacts: %@", self.logTag, __PRETTY_FUNCTION__, contacts); OWSFailDebug(@"with contacts: %@", contacts);
[self dismissViewControllerAnimated:YES completion:nil]; [self dismissViewControllerAnimated:YES completion:nil];
} }
@ -5295,7 +5295,7 @@ typedef enum : NSUInteger {
- (void)approveContactShare:(ContactShareApprovalViewController *)approveContactShare - (void)approveContactShare:(ContactShareApprovalViewController *)approveContactShare
didApproveContactShare:(ContactShareViewModel *)contactShare didApproveContactShare:(ContactShareViewModel *)contactShare
{ {
OWSLogInfo(@"%@ in %s", self.logTag, __PRETTY_FUNCTION__); OWSLogInfo(@"");
[self dismissViewControllerAnimated:YES [self dismissViewControllerAnimated:YES
completion:^{ completion:^{
@ -5306,7 +5306,7 @@ typedef enum : NSUInteger {
- (void)approveContactShare:(ContactShareApprovalViewController *)approveContactShare - (void)approveContactShare:(ContactShareApprovalViewController *)approveContactShare
didCancelContactShare:(ContactShareViewModel *)contactShare didCancelContactShare:(ContactShareViewModel *)contactShare
{ {
OWSLogInfo(@"%@ in %s", self.logTag, __PRETTY_FUNCTION__); OWSLogInfo(@"");
[self dismissViewControllerAnimated:YES completion:nil]; [self dismissViewControllerAnimated:YES completion:nil];
} }
@ -5315,7 +5315,7 @@ typedef enum : NSUInteger {
- (void)didCreateOrEditContact - (void)didCreateOrEditContact
{ {
OWSLogInfo(@"%@ in %s", self.logTag, __PRETTY_FUNCTION__); OWSLogInfo(@"");
[self dismissViewControllerAnimated:YES completion:nil]; [self dismissViewControllerAnimated:YES completion:nil];
} }
@ -5323,7 +5323,7 @@ typedef enum : NSUInteger {
- (void)presentMissingQuotedReplyToast - (void)presentMissingQuotedReplyToast
{ {
OWSLogInfo(@"%@ in %s", self.logTag, __PRETTY_FUNCTION__); OWSLogInfo(@"");
NSString *toastText = NSLocalizedString(@"QUOTED_REPLY_ORIGINAL_MESSAGE_DELETED", NSString *toastText = NSLocalizedString(@"QUOTED_REPLY_ORIGINAL_MESSAGE_DELETED",
@"Toast alert text shown when tapping on a quoted message which we cannot scroll to because the local copy of " @"Toast alert text shown when tapping on a quoted message which we cannot scroll to because the local copy of "
@ -5338,7 +5338,7 @@ typedef enum : NSUInteger {
- (void)presentRemotelySourcedQuotedReplyToast - (void)presentRemotelySourcedQuotedReplyToast
{ {
OWSLogInfo(@"%@ in %s", self.logTag, __PRETTY_FUNCTION__); OWSLogInfo(@"");
NSString *toastText = NSLocalizedString(@"QUOTED_REPLY_ORIGINAL_MESSAGE_REMOTELY_SOURCED", NSString *toastText = NSLocalizedString(@"QUOTED_REPLY_ORIGINAL_MESSAGE_REMOTELY_SOURCED",
@"Toast alert text shown when tapping on a quoted message which we cannot scroll to because the local copy of " @"Toast alert text shown when tapping on a quoted message which we cannot scroll to because the local copy of "

@ -1478,7 +1478,7 @@ NSString *const kArchivedConversationsReuseIdentifier = @"kArchivedConversations
- (void)requestReviewIfAppropriate - (void)requestReviewIfAppropriate
{ {
if (self.hasEverAppeared && Environment.preferences.hasSentAMessage) { if (self.hasEverAppeared && Environment.preferences.hasSentAMessage) {
OWSLogDebug(@"%@ in %s requesting review", self.logTag, __PRETTY_FUNCTION__); OWSLogDebug(@"requesting review");
if (@available(iOS 10, *)) { if (@available(iOS 10, *)) {
// In Debug this pops up *every* time, which is helpful, but annoying. // In Debug this pops up *every* time, which is helpful, but annoying.
// In Production this will pop up at most 3 times per 365 days. // In Production this will pop up at most 3 times per 365 days.
@ -1487,7 +1487,7 @@ NSString *const kArchivedConversationsReuseIdentifier = @"kArchivedConversations
#endif #endif
} }
} else { } else {
OWSLogDebug(@"%@ in %s not requesting review", self.logTag, __PRETTY_FUNCTION__); OWSLogDebug(@"not requesting review");
} }
} }

@ -1264,7 +1264,7 @@ const CGFloat kIconViewLength = 24;
- (void)colorPicker:(ColorPickerViewController *)colorPicker didPickColorName:(NSString *)colorName - (void)colorPicker:(ColorPickerViewController *)colorPicker didPickColorName:(NSString *)colorName
{ {
OWSLogDebug(@"%@ in %s picked color: %@", self.logTag, __PRETTY_FUNCTION__, colorName); OWSLogDebug(@"picked color: %@", colorName);
[self.editingDatabaseConnection readWriteWithBlock:^(YapDatabaseReadWriteTransaction *_Nonnull transaction) { [self.editingDatabaseConnection readWriteWithBlock:^(YapDatabaseReadWriteTransaction *_Nonnull transaction) {
[self.thread updateConversationColorName:colorName transaction:transaction]; [self.thread updateConversationColorName:colorName transaction:transaction];
}]; }];

@ -146,7 +146,7 @@ NS_ASSUME_NONNULL_BEGIN
- (void)updateLayoutForNavbar:(OWSNavigationBar *)navbar - (void)updateLayoutForNavbar:(OWSNavigationBar *)navbar
{ {
OWSLogDebug(@"%@ in %s", self.logTag, __PRETTY_FUNCTION__); OWSLogDebug(@"");
[UIView setAnimationsEnabled:NO]; [UIView setAnimationsEnabled:NO];

@ -296,7 +296,7 @@ typedef void (^SendMessageBlock)(SendCompletionBlock completion);
- (void)approveContactShare:(ContactShareApprovalViewController *)approvalViewController - (void)approveContactShare:(ContactShareApprovalViewController *)approvalViewController
didApproveContactShare:(ContactShareViewModel *)contactShare didApproveContactShare:(ContactShareViewModel *)contactShare
{ {
OWSLogInfo(@"%@ in %s", self.logTag, __PRETTY_FUNCTION__); OWSLogInfo(@"");
[ThreadUtil addThreadToProfileWhitelistIfEmptyContactThread:self.thread]; [ThreadUtil addThreadToProfileWhitelistIfEmptyContactThread:self.thread];
[self tryToSendMessageWithBlock:^(SendCompletionBlock sendCompletion) { [self tryToSendMessageWithBlock:^(SendCompletionBlock sendCompletion) {
@ -326,7 +326,7 @@ typedef void (^SendMessageBlock)(SendCompletionBlock completion);
- (void)approveContactShare:(ContactShareApprovalViewController *)approvalViewController - (void)approveContactShare:(ContactShareApprovalViewController *)approvalViewController
didCancelContactShare:(ContactShareViewModel *)contactShare didCancelContactShare:(ContactShareViewModel *)contactShare
{ {
OWSLogInfo(@"%@ in %s", self.logTag, __PRETTY_FUNCTION__); OWSLogInfo(@"");
[self cancelShareExperience]; [self cancelShareExperience];
} }

@ -332,7 +332,7 @@ NS_ASSUME_NONNULL_BEGIN
CNMutableContact *_Nullable mergedCNContact = [oldCNContact mutableCopy]; CNMutableContact *_Nullable mergedCNContact = [oldCNContact mutableCopy];
if (!mergedCNContact) { if (!mergedCNContact) {
OWSFailDebug(@"%@ in %s mergedCNContact was unexpectedly nil", self.logTag, __PRETTY_FUNCTION__); OWSFailDebug(@"mergedCNContact was unexpectedly nil");
return [CNContact new]; return [CNContact new];
} }

@ -244,10 +244,10 @@ NS_ASSUME_NONNULL_BEGIN
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
[self [self
performRemoteAttestationWithSuccess:^(RemoteAttestation *_Nonnull remoteAttestation) { performRemoteAttestationWithSuccess:^(RemoteAttestation *_Nonnull remoteAttestation) {
OWSLogDebug(@"%@ in %s succeeded", self.logTag, __PRETTY_FUNCTION__); OWSLogDebug(@"succeeded");
} }
failure:^(NSError *_Nonnull error) { failure:^(NSError *_Nonnull error) {
OWSLogDebug(@"%@ in %s failed with error: %@", self.logTag, __PRETTY_FUNCTION__, error); OWSLogDebug(@"failed with error: %@", error);
}]; }];
}); });
} }

@ -64,7 +64,7 @@ NS_ASSUME_NONNULL_BEGIN
[self contactIntersectionWithSet:[NSSet setWithArray:identifiers] [self contactIntersectionWithSet:[NSSet setWithArray:identifiers]
success:^(NSSet<SignalRecipient *> *recipients) { success:^(NSSet<SignalRecipient *> *recipients) {
if (recipients.count == 0) { if (recipients.count == 0) {
OWSLogInfo(@"%@ in %s no contacts are Signal users", self.logTag, __PRETTY_FUNCTION__); OWSLogInfo(@"no contacts are Signal users");
} }
DispatchMainThreadSafe(^{ DispatchMainThreadSafe(^{
success(recipients.allObjects); success(recipients.allObjects);

@ -70,7 +70,7 @@ NS_ASSUME_NONNULL_BEGIN
} }
if ([self.uniqueId isEqual:[TSAccountManager localNumber]] && [self.devices containsObject:@(1)]) { if ([self.uniqueId isEqual:[TSAccountManager localNumber]] && [self.devices containsObject:@(1)]) {
OWSFailDebug(@"%@ in %s self as recipient device", self.logTag, __PRETTY_FUNCTION__); OWSFailDebug(@"self as recipient device");
} }
return self; return self;
@ -112,7 +112,7 @@ NS_ASSUME_NONNULL_BEGIN
OWSAssert(devices.count > 0); OWSAssert(devices.count > 0);
if ([self.uniqueId isEqual:[TSAccountManager localNumber]] && [devices containsObject:@(1)]) { if ([self.uniqueId isEqual:[TSAccountManager localNumber]] && [devices containsObject:@(1)]) {
OWSFailDebug(@"%@ in %s adding self as recipient device", self.logTag, __PRETTY_FUNCTION__); OWSFailDebug(@"adding self as recipient device");
return; return;
} }

@ -354,11 +354,11 @@ NS_ASSUME_NONNULL_BEGIN
- (nullable NSData *)validStillImageData - (nullable NSData *)validStillImageData
{ {
if ([self isVideo]) { if ([self isVideo]) {
OWSFailDebug(@"%@ in %s isVideo was unexpectedly true", self.logTag, __PRETTY_FUNCTION__); OWSFailDebug(@"isVideo was unexpectedly true");
return nil; return nil;
} }
if ([self isAnimated]) { if ([self isAnimated]) {
OWSFailDebug(@"%@ in %s isAnimated was unexpectedly true", self.logTag, __PRETTY_FUNCTION__); OWSFailDebug(@"isAnimated was unexpectedly true");
return nil; return nil;
} }

@ -1008,7 +1008,7 @@ NSString *NSStringForContactAddressType(OWSContactAddressType value)
contact.avatarAttachmentId = attachmentPointer.uniqueId; contact.avatarAttachmentId = attachmentPointer.uniqueId;
contact.isProfileAvatar = avatarInfo.isProfile; contact.isProfileAvatar = avatarInfo.isProfile;
} else { } else {
OWSFailDebug(@"%@ in %s avatarInfo.hasAvatar was unexpectedly false", self.logTag, __PRETTY_FUNCTION__); OWSFailDebug(@"avatarInfo.hasAvatar was unexpectedly false");
} }
} }

@ -169,13 +169,13 @@ static const NSUInteger OWSMessageSchemaVersion = 4;
- (void)setExpireStartedAt:(uint64_t)expireStartedAt - (void)setExpireStartedAt:(uint64_t)expireStartedAt
{ {
if (_expireStartedAt != 0 && _expireStartedAt < expireStartedAt) { if (_expireStartedAt != 0 && _expireStartedAt < expireStartedAt) {
OWSLogDebug(@"%@ in %s ignoring later startedAt time", self.logTag, __PRETTY_FUNCTION__); OWSLogDebug(@"ignoring later startedAt time");
return; return;
} }
uint64_t now = [NSDate ows_millisecondTimeStamp]; uint64_t now = [NSDate ows_millisecondTimeStamp];
if (expireStartedAt > now) { if (expireStartedAt > now) {
OWSLogWarn(@"%@ in %s using `now` instead of future time", self.logTag, __PRETTY_FUNCTION__); OWSLogWarn(@"using `now` instead of future time");
} }
_expireStartedAt = MIN(now, expireStartedAt); _expireStartedAt = MIN(now, expireStartedAt);

@ -477,7 +477,7 @@ NSString *NSStringForOutgoingMessageRecipientState(OWSOutgoingMessageRecipientSt
// no longer be considered sent. // no longer be considered sent.
// So here we take extra care not to stop any expiration that had previously started. // So here we take extra care not to stop any expiration that had previously started.
// This can also happen under normal cirumstances with an outgoing group message. // This can also happen under normal cirumstances with an outgoing group message.
OWSLogWarn(@"%@ in %s expiration previously started", self.logTag, __PRETTY_FUNCTION__); OWSLogWarn(@"expiration previously started");
return YES; return YES;
} }
@ -904,7 +904,7 @@ NSString *NSStringForOutgoingMessageRecipientState(OWSOutgoingMessageRecipientSt
if (contactProto) { if (contactProto) {
[builder addContact:contactProto]; [builder addContact:contactProto];
} else { } else {
OWSFailDebug(@"%@ in %s contactProto was unexpectedly nil", self.logTag, __PRETTY_FUNCTION__); OWSFailDebug(@"contactProto was unexpectedly nil");
} }
} }

@ -337,7 +337,7 @@ void AssertIsOnDisappearingMessagesQueue()
- (void)disappearanceTimerDidFire - (void)disappearanceTimerDidFire
{ {
OWSAssertIsOnMainThread(); OWSAssertIsOnMainThread();
OWSLogDebug(@"%@ in %s", self.logTag, __PRETTY_FUNCTION__); OWSLogDebug(@"");
if (!CurrentAppContext().isMainAppAndActive) { if (!CurrentAppContext().isMainAppAndActive) {
// Don't schedule run when inactive or not in main app. // Don't schedule run when inactive or not in main app.
@ -355,7 +355,7 @@ void AssertIsOnDisappearingMessagesQueue()
- (void)fallbackTimerDidFire - (void)fallbackTimerDidFire
{ {
OWSAssertIsOnMainThread(); OWSAssertIsOnMainThread();
OWSLogDebug(@"%@ in %s", self.logTag, __PRETTY_FUNCTION__); OWSLogDebug(@"");
BOOL recentlyScheduledDisappearanceTimer = NO; BOOL recentlyScheduledDisappearanceTimer = NO;
if (fabs(self.nextDisappearanceDate.timeIntervalSinceNow) < 1.0) { if (fabs(self.nextDisappearanceDate.timeIntervalSinceNow) < 1.0) {

@ -1162,7 +1162,7 @@ NS_ASSUME_NONNULL_BEGIN
[TSAttachmentPointer fetchObjectWithUniqueID:contact.avatarAttachmentId transaction:transaction]; [TSAttachmentPointer fetchObjectWithUniqueID:contact.avatarAttachmentId transaction:transaction];
if (![attachmentPointer isKindOfClass:[TSAttachmentPointer class]]) { if (![attachmentPointer isKindOfClass:[TSAttachmentPointer class]]) {
OWSFailDebug(@"%@ in %s avatar attachmentPointer was unexpectedly nil", self.logTag, __PRETTY_FUNCTION__); OWSFailDebug(@"avatar attachmentPointer was unexpectedly nil");
} else { } else {
OWSAttachmentsProcessor *attachmentProcessor = OWSAttachmentsProcessor *attachmentProcessor =
[[OWSAttachmentsProcessor alloc] initWithAttachmentPointer:attachmentPointer [[OWSAttachmentsProcessor alloc] initWithAttachmentPointer:attachmentPointer

@ -454,12 +454,12 @@ NSString *const OWSReadReceiptManagerAreReadReceiptsEnabled = @"areReadReceiptsE
uint64_t messageIdTimestamp = readReceiptProto.timestamp; uint64_t messageIdTimestamp = readReceiptProto.timestamp;
if (senderId.length == 0) { if (senderId.length == 0) {
OWSFailDebug(@"%@ in %s senderId was unexpectedly nil", self.logTag, __PRETTY_FUNCTION__); OWSFailDebug(@"senderId was unexpectedly nil");
continue; continue;
} }
if (messageIdTimestamp == 0) { if (messageIdTimestamp == 0) {
OWSFailDebug(@"%@ in %s messageIdTimestamp was unexpectedly 0", self.logTag, __PRETTY_FUNCTION__); OWSFailDebug(@"messageIdTimestamp was unexpectedly 0");
continue; continue;
} }

@ -121,7 +121,7 @@ NSString *const OWSIncomingMessageFinderColumnSourceDeviceId = @"OWSIncomingMess
{ {
#ifdef DEBUG #ifdef DEBUG
if (![self.primaryStorage registeredExtension:OWSIncomingMessageFinderExtensionName]) { if (![self.primaryStorage registeredExtension:OWSIncomingMessageFinderExtensionName]) {
OWSFailDebug(@"%@ in %s but extension is not registered", self.logTag, __PRETTY_FUNCTION__); OWSFailDebug(@"but extension is not registered");
// we should be initializing this at startup rather than have an unexpectedly slow lazy setup at random. // we should be initializing this at startup rather than have an unexpectedly slow lazy setup at random.
[self registerExtension]; [self registerExtension];

@ -227,7 +227,7 @@ NS_ASSUME_NONNULL_BEGIN
{ {
TSYapDatabaseObject *latest = [[self class] fetchObjectWithUniqueID:self.uniqueId]; TSYapDatabaseObject *latest = [[self class] fetchObjectWithUniqueID:self.uniqueId];
if (!latest) { if (!latest) {
OWSFailDebug(@"%@ in %s `latest` was unexpectedly nil", self.logTag, __PRETTY_FUNCTION__); OWSFailDebug(@"`latest` was unexpectedly nil");
return; return;
} }

@ -176,7 +176,7 @@ NS_ASSUME_NONNULL_BEGIN
- (void)setMainAppBadgeNumber:(NSInteger)value - (void)setMainAppBadgeNumber:(NSInteger)value
{ {
OWSFailDebug(@"%@ called %s.", self.logTag, __PRETTY_FUNCTION__); OWSFailDebug(@"");
} }
- (nullable UIViewController *)frontmostViewController - (nullable UIViewController *)frontmostViewController
@ -193,7 +193,7 @@ NS_ASSUME_NONNULL_BEGIN
- (void)doMultiDeviceUpdateWithProfileKey:(OWSAES256Key *)profileKey - (void)doMultiDeviceUpdateWithProfileKey:(OWSAES256Key *)profileKey
{ {
OWSFailDebug(@"%@ called %s.", self.logTag, __PRETTY_FUNCTION__); OWSFailDebug(@"");
} }
- (BOOL)isRunningTests - (BOOL)isRunningTests
@ -204,7 +204,7 @@ NS_ASSUME_NONNULL_BEGIN
- (void)setNetworkActivityIndicatorVisible:(BOOL)value - (void)setNetworkActivityIndicatorVisible:(BOOL)value
{ {
OWSFailDebug(@"%@ called %s.", self.logTag, __PRETTY_FUNCTION__); OWSFailDebug(@"");
} }
- (void)runNowOrWhenMainAppIsActive:(AppActiveBlock)block - (void)runNowOrWhenMainAppIsActive:(AppActiveBlock)block

Loading…
Cancel
Save