Apply OWS log functions in Objective-C.

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

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

@ -592,13 +592,13 @@ typedef enum : NSUInteger {
- (BOOL)becomeFirstResponder
{
OWSLogDebug(@"%@ in %s", self.logTag, __PRETTY_FUNCTION__);
OWSLogDebug(@"");
return [super becomeFirstResponder];
}
- (BOOL)resignFirstResponder
{
OWSLogDebug(@"%@ in %s", self.logTag, __PRETTY_FUNCTION__);
OWSLogDebug(@"");
return [super resignFirstResponder];
}
@ -2317,7 +2317,7 @@ typedef enum : NSUInteger {
TSMessage *message = (TSMessage *)viewItem.interaction;
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;
}
@ -5225,13 +5225,13 @@ typedef enum : NSUInteger {
- (void)contactsPickerDidCancel:(ContactsPicker *)contactsPicker
{
OWSLogDebug(@"%@ in %s", self.logTag, __PRETTY_FUNCTION__);
OWSLogDebug(@"");
[self dismissViewControllerAnimated:YES completion:nil];
}
- (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];
}
@ -5245,7 +5245,7 @@ typedef enum : NSUInteger {
return;
}
OWSLogDebug(@"%@ in %s with contact: %@", self.logTag, __PRETTY_FUNCTION__, contact);
OWSLogDebug(@"with contact: %@", contact);
OWSContact *_Nullable contactShareRecord = [OWSContacts contactForSystemContact:cnContact];
if (!contactShareRecord) {
@ -5280,7 +5280,7 @@ typedef enum : NSUInteger {
- (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];
}
@ -5295,7 +5295,7 @@ typedef enum : NSUInteger {
- (void)approveContactShare:(ContactShareApprovalViewController *)approveContactShare
didApproveContactShare:(ContactShareViewModel *)contactShare
{
OWSLogInfo(@"%@ in %s", self.logTag, __PRETTY_FUNCTION__);
OWSLogInfo(@"");
[self dismissViewControllerAnimated:YES
completion:^{
@ -5306,7 +5306,7 @@ typedef enum : NSUInteger {
- (void)approveContactShare:(ContactShareApprovalViewController *)approveContactShare
didCancelContactShare:(ContactShareViewModel *)contactShare
{
OWSLogInfo(@"%@ in %s", self.logTag, __PRETTY_FUNCTION__);
OWSLogInfo(@"");
[self dismissViewControllerAnimated:YES completion:nil];
}
@ -5315,7 +5315,7 @@ typedef enum : NSUInteger {
- (void)didCreateOrEditContact
{
OWSLogInfo(@"%@ in %s", self.logTag, __PRETTY_FUNCTION__);
OWSLogInfo(@"");
[self dismissViewControllerAnimated:YES completion:nil];
}
@ -5323,7 +5323,7 @@ typedef enum : NSUInteger {
- (void)presentMissingQuotedReplyToast
{
OWSLogInfo(@"%@ in %s", self.logTag, __PRETTY_FUNCTION__);
OWSLogInfo(@"");
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 "
@ -5338,7 +5338,7 @@ typedef enum : NSUInteger {
- (void)presentRemotelySourcedQuotedReplyToast
{
OWSLogInfo(@"%@ in %s", self.logTag, __PRETTY_FUNCTION__);
OWSLogInfo(@"");
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 "

@ -1478,7 +1478,7 @@ NSString *const kArchivedConversationsReuseIdentifier = @"kArchivedConversations
- (void)requestReviewIfAppropriate
{
if (self.hasEverAppeared && Environment.preferences.hasSentAMessage) {
OWSLogDebug(@"%@ in %s requesting review", self.logTag, __PRETTY_FUNCTION__);
OWSLogDebug(@"requesting review");
if (@available(iOS 10, *)) {
// 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.
@ -1487,7 +1487,7 @@ NSString *const kArchivedConversationsReuseIdentifier = @"kArchivedConversations
#endif
}
} 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
{
OWSLogDebug(@"%@ in %s picked color: %@", self.logTag, __PRETTY_FUNCTION__, colorName);
OWSLogDebug(@"picked color: %@", colorName);
[self.editingDatabaseConnection readWriteWithBlock:^(YapDatabaseReadWriteTransaction *_Nonnull transaction) {
[self.thread updateConversationColorName:colorName transaction:transaction];
}];

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

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

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

@ -244,10 +244,10 @@ NS_ASSUME_NONNULL_BEGIN
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
[self
performRemoteAttestationWithSuccess:^(RemoteAttestation *_Nonnull remoteAttestation) {
OWSLogDebug(@"%@ in %s succeeded", self.logTag, __PRETTY_FUNCTION__);
OWSLogDebug(@"succeeded");
}
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]
success:^(NSSet<SignalRecipient *> *recipients) {
if (recipients.count == 0) {
OWSLogInfo(@"%@ in %s no contacts are Signal users", self.logTag, __PRETTY_FUNCTION__);
OWSLogInfo(@"no contacts are Signal users");
}
DispatchMainThreadSafe(^{
success(recipients.allObjects);

@ -70,7 +70,7 @@ NS_ASSUME_NONNULL_BEGIN
}
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;
@ -112,7 +112,7 @@ NS_ASSUME_NONNULL_BEGIN
OWSAssert(devices.count > 0);
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;
}

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

@ -1008,7 +1008,7 @@ NSString *NSStringForContactAddressType(OWSContactAddressType value)
contact.avatarAttachmentId = attachmentPointer.uniqueId;
contact.isProfileAvatar = avatarInfo.isProfile;
} 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
{
if (_expireStartedAt != 0 && _expireStartedAt < expireStartedAt) {
OWSLogDebug(@"%@ in %s ignoring later startedAt time", self.logTag, __PRETTY_FUNCTION__);
OWSLogDebug(@"ignoring later startedAt time");
return;
}
uint64_t now = [NSDate ows_millisecondTimeStamp];
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);

@ -477,7 +477,7 @@ NSString *NSStringForOutgoingMessageRecipientState(OWSOutgoingMessageRecipientSt
// no longer be considered sent.
// 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.
OWSLogWarn(@"%@ in %s expiration previously started", self.logTag, __PRETTY_FUNCTION__);
OWSLogWarn(@"expiration previously started");
return YES;
}
@ -904,7 +904,7 @@ NSString *NSStringForOutgoingMessageRecipientState(OWSOutgoingMessageRecipientSt
if (contactProto) {
[builder addContact:contactProto];
} 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
{
OWSAssertIsOnMainThread();
OWSLogDebug(@"%@ in %s", self.logTag, __PRETTY_FUNCTION__);
OWSLogDebug(@"");
if (!CurrentAppContext().isMainAppAndActive) {
// Don't schedule run when inactive or not in main app.
@ -355,7 +355,7 @@ void AssertIsOnDisappearingMessagesQueue()
- (void)fallbackTimerDidFire
{
OWSAssertIsOnMainThread();
OWSLogDebug(@"%@ in %s", self.logTag, __PRETTY_FUNCTION__);
OWSLogDebug(@"");
BOOL recentlyScheduledDisappearanceTimer = NO;
if (fabs(self.nextDisappearanceDate.timeIntervalSinceNow) < 1.0) {

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

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

@ -121,7 +121,7 @@ NSString *const OWSIncomingMessageFinderColumnSourceDeviceId = @"OWSIncomingMess
{
#ifdef DEBUG
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.
[self registerExtension];

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

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

Loading…
Cancel
Save