Add some debug logging

This commit is contained in:
Maurice Parker 2019-05-08 08:20:29 -05:00
parent e52dc84f13
commit f12494cc31
2 changed files with 17 additions and 6 deletions

View File

@ -14,13 +14,16 @@ import RSCore
#endif #endif
import RSCore import RSCore
import RSWeb import RSWeb
import os.log
final class FeedbinAccountDelegate: AccountDelegate { final class FeedbinAccountDelegate: AccountDelegate {
private let caller: FeedbinAPICaller
private var log = OSLog(subsystem: Bundle.main.bundleIdentifier!, category: "Feedbin")
let supportsSubFolders = false let supportsSubFolders = false
let server: String? = "api.feedbin.com" let server: String? = "api.feedbin.com"
private let caller: FeedbinAPICaller
var credentials: Credentials? { var credentials: Credentials? {
didSet { didSet {
caller.credentials = credentials caller.credentials = credentials
@ -160,6 +163,8 @@ private extension FeedbinAccountDelegate {
guard let tags = tags else { return } guard let tags = tags else { return }
os_log(.debug, log: log, "Syncing folders with %ld tags.", tags.count)
let tagNames = tags.map { $0.name } let tagNames = tags.map { $0.name }
// Delete any folders not at Feedbin // Delete any folders not at Feedbin
@ -242,6 +247,8 @@ private extension FeedbinAccountDelegate {
guard let subscriptions = subscriptions else { return } guard let subscriptions = subscriptions else { return }
os_log(.debug, log: log, "Syncing feeds with %ld subscriptions.", subscriptions.count)
let subFeedIds = subscriptions.map { String($0.feedID) } let subFeedIds = subscriptions.map { String($0.feedID) }
// Remove any feeds that are no longer in the subscriptions // Remove any feeds that are no longer in the subscriptions
@ -288,6 +295,8 @@ private extension FeedbinAccountDelegate {
guard let taggings = taggings else { return } guard let taggings = taggings else { return }
os_log(.debug, log: log, "Syncing taggings with %ld taggings.", taggings.count)
// Set up some structures to make syncing easier // Set up some structures to make syncing easier
let folderDict: [String: Folder] = { let folderDict: [String: Folder] = {
if let folders = account.folders { if let folders = account.folders {
@ -349,7 +358,7 @@ private extension FeedbinAccountDelegate {
let taggedFeedIDs = Set(taggings.map { String($0.feedID) }) let taggedFeedIDs = Set(taggings.map { String($0.feedID) })
// Delete all the feeds without a tag // Remove all feeds from the account container that have a tag
var feedsToDelete = Set<Feed>() var feedsToDelete = Set<Feed>()
for feed in account.topLevelFeeds { for feed in account.topLevelFeeds {
if taggedFeedIDs.contains(feed.feedID) { if taggedFeedIDs.contains(feed.feedID) {
@ -367,6 +376,8 @@ private extension FeedbinAccountDelegate {
guard let icons = icons else { return } guard let icons = icons else { return }
os_log(.debug, log: log, "Syncing favicons with %ld icons.", icons.count)
let iconDict = Dictionary(uniqueKeysWithValues: icons.map { ($0.host, $0.url) } ) let iconDict = Dictionary(uniqueKeysWithValues: icons.map { ($0.host, $0.url) } )
for feed in account.flattenedFeeds() { for feed in account.flattenedFeeds() {

View File

@ -8,13 +8,13 @@ DEVELOPMENT_TEAM = M8L2WTLA8W
#include? "../../../SharedXcodeSettings/DeveloperSettings.xcconfig" #include? "../../../SharedXcodeSettings/DeveloperSettings.xcconfig"
SDKROOT = macosx SDKROOT = macosx
MACOSX_DEPLOYMENT_TARGET = 10.13 MACOSX_DEPLOYMENT_TARGET = 10.14
CLANG_ENABLE_OBJC_WEAK = YES CLANG_ENABLE_OBJC_WEAK = YES
SWIFT_VERSION = 5.0 SWIFT_VERSION = 5.0
COMBINE_HIDPI_IMAGES = YES COMBINE_HIDPI_IMAGES = YES
COPY_PHASE_STRIP = NO COPY_PHASE_STRIP = NO
MACOSX_DEPLOYMENT_TARGET = 10.13 MACOSX_DEPLOYMENT_TARGET = 10.14
ALWAYS_SEARCH_USER_PATHS = NO ALWAYS_SEARCH_USER_PATHS = NO
CURRENT_PROJECT_VERSION = 1 CURRENT_PROJECT_VERSION = 1
VERSION_INFO_PREFIX = VERSION_INFO_PREFIX =