Change visibility of system error messages included in logs so that they are useful in production

This commit is contained in:
Maurice Parker
2022-09-29 16:13:24 -05:00
parent e520c45032
commit 8f82d32665
21 changed files with 46 additions and 46 deletions

View File

@@ -99,7 +99,7 @@ private extension CloudKitArticlesZoneDelegate {
account?.markAsUnread(updateableUnreadArticleIDs) { result in
if case .failure(let databaseError) = result {
errorOccurred = true
self.logger.error("Error occurred while storing unread statuses: \(databaseError.localizedDescription)")
self.logger.error("Error occurred while storing unread statuses: \(databaseError.localizedDescription, privacy: .public)")
}
group.leave()
}
@@ -108,7 +108,7 @@ private extension CloudKitArticlesZoneDelegate {
account?.markAsRead(updateableReadArticleIDs) { result in
if case .failure(let databaseError) = result {
errorOccurred = true
self.logger.error("Error occurred while storing read statuses: \(databaseError.localizedDescription)")
self.logger.error("Error occurred while storing read statuses: \(databaseError.localizedDescription, privacy: .public)")
}
group.leave()
}
@@ -117,7 +117,7 @@ private extension CloudKitArticlesZoneDelegate {
account?.markAsUnstarred(updateableUnstarredArticleIDs) { result in
if case .failure(let databaseError) = result {
errorOccurred = true
self.logger.error("Error occurred while storing unstarred statuses: \(databaseError.localizedDescription)")
self.logger.error("Error occurred while storing unstarred statuses: \(databaseError.localizedDescription, privacy: .public)")
}
group.leave()
}
@@ -126,7 +126,7 @@ private extension CloudKitArticlesZoneDelegate {
account?.markAsStarred(updateableStarredArticleIDs) { result in
if case .failure(let databaseError) = result {
errorOccurred = true
self.logger.error("Error occurred while stroing starred records: \(databaseError.localizedDescription)")
self.logger.error("Error occurred while stroing starred records: \(databaseError.localizedDescription, privacy: .public)")
}
group.leave()
}
@@ -152,7 +152,7 @@ private extension CloudKitArticlesZoneDelegate {
}
case .failure(let databaseError):
errorOccurred = true
self.logger.error("Error occurred while storing articles: \(databaseError.localizedDescription)")
self.logger.error("Error occurred while storing articles: \(databaseError.localizedDescription, privacy: .public)")
group.leave()
}
}

View File

@@ -49,7 +49,7 @@ class CloudKitSendStatusOperation: MainThreadOperation, Logging {
self.refreshProgress?.addToNumberOfTasksAndRemaining(ticks)
self.selectForProcessing()
case .failure(let databaseError):
self.logger.error("Send status count pending error: \(databaseError.localizedDescription)")
self.logger.error("Send status count pending error: \(databaseError.localizedDescription, privacy: .public)")
self.operationDelegate?.cancelOperation(self)
}
}
@@ -93,7 +93,7 @@ private extension CloudKitSendStatusOperation {
}
case .failure(let databaseError):
self.logger.error("Send status error: \(databaseError.localizedDescription)")
self.logger.error("Send status error: \(databaseError.localizedDescription, privacy: .public)")
self.operationDelegate?.cancelOperation(self)
}
}

View File

@@ -863,7 +863,7 @@ private extension FeedbinAccountDelegate {
guard let taggings = taggings else { return }
assert(Thread.isMainThread)
logger.debug("Syncing taggings with \(taggings.count) taggings.")
logger.debug("Syncing taggings with \(taggings.count, privacy: .public) taggings.")
// Set up some structures to make syncing easier
let folderDict = nameToFolderDictionary(with: account.folders)

View File

@@ -132,7 +132,7 @@ final class FeedlyAccountDelegate: AccountDelegate, Logging {
self?.accountMetadata?.lastArticleFetchEndTime = Date()
}
self?.logger.debug("Sync took \(-date.timeIntervalSinceNow) seconds.")
self?.logger.debug("Sync took \(-date.timeIntervalSinceNow, privacy: .public) seconds.")
completion(result)
}
@@ -150,12 +150,12 @@ final class FeedlyAccountDelegate: AccountDelegate, Logging {
case .success:
completion?(.success(()))
case .failure(let error):
self.logger.error("Failed to refresh article status for account \(String(describing: account.type)): \(error.localizedDescription, privacy: .public)")
self.logger.error("Failed to refresh article status for account \(String(describing: account.type), privacy: .public): \(error.localizedDescription, privacy: .public)")
completion?(.failure(error))
}
}
case .failure(let error):
self.logger.error("Failed to send article status for account \(String(describing: account.type)): \(error.localizedDescription, privacy: .public)")
self.logger.error("Failed to send article status for account \(String(describing: account.type), privacy: .public): \(error.localizedDescription, privacy: .public)")
completion?(.failure(error))
}
}

View File

@@ -91,7 +91,7 @@ final class FeedlyCreateFeedsForCollectionFoldersOperation: FeedlyOperation, Log
return (feed, folder)
}
logger.debug("Processing \(feedsAndFolders.count) feeds.")
logger.debug("Processing \(feedsAndFolders.count, privacy: .public) feeds.")
feedsAndFolders.forEach { (feed, folder) in
if !folder.has(feed) {
folder.addWebFeed(feed)
@@ -104,7 +104,7 @@ final class FeedlyCreateFeedsForCollectionFoldersOperation: FeedlyOperation, Log
account.removeFeeds(feedsWithoutCollections)
if !feedsWithoutCollections.isEmpty {
logger.debug("Removed \(feedsWithoutCollections.count) feeds.")
logger.debug("Removed \(feedsWithoutCollections.count, privacy: .public) feeds.")
}
}
}

View File

@@ -35,7 +35,7 @@ class FeedlyDownloadArticlesOperation: FeedlyOperation, Logging {
var articleIds = missingArticleEntryIdProvider.entryIds
articleIds.formUnion(updatedArticleEntryIdProvider.entryIds)
self.logger.debug("Requesting \(articleIds.count) articles.")
self.logger.debug("Requesting \(articleIds.count, privacy: .public) articles.")
let feedlyAPILimitBatchSize = 1000
for articleIds in Array(articleIds).chunked(into: feedlyAPILimitBatchSize) {
@@ -65,7 +65,7 @@ class FeedlyDownloadArticlesOperation: FeedlyOperation, Logging {
}
override func didCancel() {
logger.debug("Cancelling \(String(describing: self)).")
logger.debug("Cancelling \(String(describing: self), privacy: .public).")
operationQueue.cancelAllOperations()
super.didCancel()
}
@@ -84,7 +84,7 @@ extension FeedlyDownloadArticlesOperation: FeedlyOperationDelegate {
assert(Thread.isMainThread)
// Having this log is useful for debugging missing required JSON keys in the response from Feedly, for example.
self.logger.debug("\(String(describing: operation)) failed with error: \(error.localizedDescription, privacy: .public)")
self.logger.debug("\(String(describing: operation), privacy: .public) failed with error: \(error.localizedDescription, privacy: .public)")
cancel()
}

View File

@@ -30,7 +30,7 @@ final class FeedlyGetCollectionsOperation: FeedlyOperation, FeedlyCollectionProv
service.getCollections { result in
switch result {
case .success(let collections):
self.logger.debug("Receving collections: \(collections.map({ $0.id }))")
self.logger.debug("Receving collections: \(collections.map({ $0.id }), privacy: .public)")
self.collections = collections
self.didFinish()

View File

@@ -40,7 +40,7 @@ final class FeedlyGetEntriesOperation: FeedlyOperation, FeedlyEntryProviding, Fe
let entryIds = Set(entries.map { $0.id })
let parsedIds = Set(parsed.map { $0.uniqueID })
let difference = entryIds.subtracting(parsedIds)
self.logger.debug("\(String(describing: self)) dropping articles with ids: \(difference)).")
self.logger.debug("\(String(describing: self), privacy: .public) dropping articles with ids: \(difference)).")
}
storedParsedEntries = parsed

View File

@@ -58,7 +58,7 @@ final class FeedlyGetStreamContentsOperation: FeedlyOperation, FeedlyEntryProvid
let entryIds = Set(entries.map { $0.id })
let parsedIds = Set(parsed.map { $0.uniqueID })
let difference = entryIds.subtracting(parsedIds)
logger.debug("Dropping articles with ids: \(difference)")
logger.debug("Dropping articles with ids: \(difference, privacy: .public)")
}
storedParsedEntries = parsed

View File

@@ -64,7 +64,7 @@ class FeedlyGetUpdatedArticleIdsOperation: FeedlyOperation, FeedlyEntryIdentifie
storedUpdatedArticleIds.formUnion(streamIds.ids)
guard let continuation = streamIds.continuation else {
self.logger.debug("\(self.storedUpdatedArticleIds.count) articles updated since last successful sync start date.")
self.logger.debug("\(self.storedUpdatedArticleIds.count, privacy: .public) articles updated since last successful sync start date.")
didFinish()
return
}

View File

@@ -56,7 +56,7 @@ class FeedlyIngestStreamArticleIdsOperation: FeedlyOperation, Logging {
}
guard let continuation = streamIds.continuation else {
self.logger.debug("Reached end of stream: \(self.resource.id).")
self.logger.debug("Reached end of stream: \(self.resource.id, privacy: .public).")
self.didFinish()
return
}

View File

@@ -24,7 +24,7 @@ final class FeedlyLogoutOperation: FeedlyOperation, Logging {
}
override func run() {
self.logger.debug("Requesting logout of \(String(describing: self.account.type)).")
self.logger.debug("Requesting logout of \(String(describing: self.account.type), privacy: .public).")
service.logout(completion: didCompleteLogout(_:))
}
@@ -32,7 +32,7 @@ final class FeedlyLogoutOperation: FeedlyOperation, Logging {
assert(Thread.isMainThread)
switch result {
case .success:
self.logger.debug("Logged out of \(String(describing: self.account.type)).")
self.logger.debug("Logged out of \(String(describing: self.account.type), privacy: .public).")
do {
try account.removeCredentials(type: .oauthAccessToken)
try account.removeCredentials(type: .oauthRefreshToken)

View File

@@ -44,7 +44,7 @@ final class FeedlyMirrorCollectionsAsFoldersOperation: FeedlyOperation, FeedlyFe
return (collection.feeds, folder)
}
self.logger.debug("Ensured \(self.feedsAndFolders.count) folders for \(collections.count) collections.")
self.logger.debug("Ensured \(self.feedsAndFolders.count, privacy: .public) folders for \(collections.count, privacy: .public) collections.")
// Remove folders without a corresponding collection
let collectionFolders = Set(feedsAndFolders.map { $0.1 })
@@ -55,7 +55,7 @@ final class FeedlyMirrorCollectionsAsFoldersOperation: FeedlyOperation, FeedlyFe
account.removeFolder(unmatched)
}
self.logger.debug("Removed \(foldersWithoutCollections.count) folders: \(foldersWithoutCollections.map({ $0.externalID ?? $0.nameForDisplay }))")
self.logger.debug("Removed \(foldersWithoutCollections.count, privacy: .public) folders: \(foldersWithoutCollections.map({ $0.externalID ?? $0.nameForDisplay }), privacy: .public)")
}
}
}

View File

@@ -58,7 +58,7 @@ final class FeedlyOrganiseParsedItemsByFeedOperation: FeedlyOperation, FeedlyPar
dict[key] = value
}
self.logger.debug("Grouped \(items.count) items by \(dict.count) feeds for \(self.parsedItemProvider.parsedItemProviderName).")
self.logger.debug("Grouped \(items.count, privacy: .public) items by \(dict.count, privacy: .public) feeds for \(self.parsedItemProvider.parsedItemProviderName, privacy: .public).")
itemsKeyedByFeedId = dict
}

View File

@@ -52,6 +52,6 @@ final class FeedlyRequestStreamsOperation: FeedlyOperation, Logging {
queueDelegate?.feedlyRequestStreamsOperation(self, enqueue: operation)
}
self.logger.debug("Requested \(self.collectionsProvider.collections.count) collections streams.")
self.logger.debug("Requested \(self.collectionsProvider.collections.count, privacy: .public) collections streams.")
}
}

View File

@@ -127,12 +127,12 @@ final class FeedlySyncAllOperation: FeedlyOperation, Logging {
}
override func run() {
logger.debug("Starting sync \(self.syncUUID.uuidString).")
logger.debug("Starting sync \(self.syncUUID.uuidString, privacy: .public).")
operationQueue.resume()
}
override func didCancel() {
logger.debug("Cancelling sync \(self.syncUUID.uuidString).")
logger.debug("Cancelling sync \(self.syncUUID.uuidString, privacy: .public).")
self.operationQueue.cancelAllOperations()
syncCompletionHandler = nil
super.didCancel()
@@ -143,7 +143,7 @@ extension FeedlySyncAllOperation: FeedlyCheckpointOperationDelegate {
func feedlyCheckpointOperationDidReachCheckpoint(_ operation: FeedlyCheckpointOperation) {
assert(Thread.isMainThread)
logger.debug("Sync completed: \(self.syncUUID.uuidString).")
logger.debug("Sync completed: \(self.syncUUID.uuidString, privacy: .public).")
syncCompletionHandler?(.success(()))
syncCompletionHandler = nil
@@ -158,7 +158,7 @@ extension FeedlySyncAllOperation: FeedlyOperationDelegate {
assert(Thread.isMainThread)
// Having this log is useful for debugging missing required JSON keys in the response from Feedly, for example.
logger.debug("\(String(describing: operation)) failed with error: \(error.localizedDescription, privacy: .public).")
logger.debug("\(String(describing: operation), privacy: .public) failed with error: \(error.localizedDescription, privacy: .public).")
syncCompletionHandler?(.failure(error))
syncCompletionHandler = nil

View File

@@ -48,13 +48,13 @@ final class FeedlySyncStreamContentsOperation: FeedlyOperation, FeedlyOperationD
}
override func didCancel() {
self.logger.debug("Cancelling sync stream contents for \(self.resource.id).")
self.logger.debug("Cancelling sync stream contents for \(self.resource.id, privacy: .public).")
operationQueue.cancelAllOperations()
super.didCancel()
}
func enqueueOperations(for continuation: String?) {
self.logger.debug("Requesting page for \(self.resource.id).")
self.logger.debug("Requesting page for \(self.resource.id, privacy: .public).")
let operations = pageOperations(for: continuation)
operationQueue.addOperations(operations)
}
@@ -87,14 +87,14 @@ final class FeedlySyncStreamContentsOperation: FeedlyOperation, FeedlyOperationD
func feedlyGetStreamContentsOperation(_ operation: FeedlyGetStreamContentsOperation, didGetContentsOf stream: FeedlyStream) {
guard !isCanceled else {
self.logger.debug("Cancelled requesting page for \(self.resource.id).")
self.logger.debug("Cancelled requesting page for \(self.resource.id, privacy: .public).")
return
}
self.logger.debug("Ingesting \(stream.items.count) from \(stream.id).")
self.logger.debug("Ingesting \(stream.items.count, privacy: .public) from \(stream.id, privacy: .public).")
guard isPagingEnabled, let continuation = stream.continuation else {
self.logger.debug("Reached end of stream for \(stream.id).")
self.logger.debug("Reached end of stream for \(stream.id, privacy: .public).")
return
}
@@ -102,7 +102,7 @@ final class FeedlySyncStreamContentsOperation: FeedlyOperation, FeedlyOperationD
}
func feedlyCheckpointOperationDidReachCheckpoint(_ operation: FeedlyCheckpointOperation) {
self.logger.debug("Completed ingesting items from \(self.resource.id).")
self.logger.debug("Completed ingesting items from \(self.resource.id, privacy: .public).")
didFinish()
}

View File

@@ -30,7 +30,7 @@ final class FeedlyUpdateAccountFeedsWithItemsOperation: FeedlyOperation, Logging
return
}
self.logger.debug("Updated \(webFeedIDsAndItems.count) feeds for \(self.organisedItemsProvider.parsedItemsByFeedProviderName).")
self.logger.debug("Updated \(webFeedIDsAndItems.count, privacy: .public) feeds for \(self.organisedItemsProvider.parsedItemsByFeedProviderName, privacy: .public).")
self.didFinish()
}
}

View File

@@ -39,7 +39,7 @@ extension NewsBlurAccountDelegate {
guard let folders = folders else { return }
assert(Thread.isMainThread)
logger.debug("Syncing folders with \(folders.count) folders.")
logger.debug("Syncing folders with \(folders.count, privacy: .public) folders.")
let folderNames = folders.map { $0.name }
@@ -77,7 +77,7 @@ extension NewsBlurAccountDelegate {
guard let feeds = feeds else { return }
assert(Thread.isMainThread)
logger.debug("Syncing feeds with \(feeds.count) feeds.")
logger.debug("Syncing feeds with \(feeds.count, privacy: .public) feeds.")
let newsBlurFeedIds = feeds.map { String($0.feedID) }
@@ -128,7 +128,7 @@ extension NewsBlurAccountDelegate {
guard let folders = folders else { return }
assert(Thread.isMainThread)
logger.debug("Syncing folders with \(folders.count) folders.")
logger.debug("Syncing folders with \(folders.count, privacy: .public) folders.")
// Set up some structures to make syncing easier
let relationships = folders.map({ $0.asRelationships }).flatMap { $0 }

View File

@@ -709,7 +709,7 @@ private extension ReaderAPIAccountDelegate {
guard !folderTags.isEmpty else { return }
logger.debug("Syncing folders with \(folderTags.count) tags.")
logger.debug("Syncing folders with \(folderTags.count, privacy: .public) tags.")
let readerFolderExternalIDs = folderTags.compactMap { $0.tagID }
@@ -749,7 +749,7 @@ private extension ReaderAPIAccountDelegate {
guard let subscriptions = subscriptions else { return }
assert(Thread.isMainThread)
logger.debug("Syncing feeds with \(subscriptions.count) subscriptions")
logger.debug("Syncing feeds with \(subscriptions.count, privacy: .public) subscriptions")
let subFeedIds = subscriptions.map { $0.feedID }
@@ -791,7 +791,7 @@ private extension ReaderAPIAccountDelegate {
func syncFeedFolderRelationship(_ account: Account, _ subscriptions: [ReaderAPISubscription]?) {
guard let subscriptions = subscriptions else { return }
assert(Thread.isMainThread)
logger.debug("Syncing taggins with \(subscriptions.count) subscriptions.")
logger.debug("Syncing taggins with \(subscriptions.count, privacy: .public) subscriptions.")
// Set up some structures to make syncing easier
let folderDict = externalIDToFolderDictionary(with: account.folders)

View File

@@ -60,8 +60,8 @@
"repositoryURL": "https://github.com/Ranchero-Software/RSCore.git",
"state": {
"branch": null,
"revision": "3af73640bcf7bcfd1a462986d5a1c69b37822155",
"version": "1.0.13"
"revision": "4425a29db97b97c44e9ebee16e6090b116b10055",
"version": "1.0.14"
}
},
{