Commit 6ba2e50325

6ba2e5032572f982abf2032aa6298e8bc95fe65e

parent: 258ce2b73b

Unsigned

cmc <hello@cleberg.net> · 2026-04-12 15:11 UTC

chore: clean up debug logging

Layout: unified · split

Hutch.xcodeproj/project.pbxproj +8 −8
@@ -515,7 +515,7 @@
515515 ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
516516 CODE_SIGN_ENTITLEMENTS = Hutch/Hutch.entitlements;
517517 CODE_SIGN_STYLE = Automatic;
518 CURRENT_PROJECT_VERSION = 32;
518 CURRENT_PROJECT_VERSION = 33;
519519 DEVELOPMENT_TEAM = ZCNAX3VL9D;
520520 ENABLE_PREVIEWS = YES;
521521 GENERATE_INFOPLIST_FILE = YES;
@@ -532,7 +532,7 @@
532532 "$(inherited)",
533533 "@executable_path/Frameworks",
534534 );
535 MARKETING_VERSION = 2.15.0;
535 MARKETING_VERSION = 2.15.1;
536536 PRODUCT_BUNDLE_IDENTIFIER = net.cleberg.Hutch;
537537 PRODUCT_NAME = "$(TARGET_NAME)";
538538 STRING_CATALOG_GENERATE_SYMBOLS = YES;
@@ -552,7 +552,7 @@
552552 ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
553553 CODE_SIGN_ENTITLEMENTS = Hutch/Hutch.entitlements;
554554 CODE_SIGN_STYLE = Automatic;
555 CURRENT_PROJECT_VERSION = 32;
555 CURRENT_PROJECT_VERSION = 33;
556556 DEVELOPMENT_TEAM = ZCNAX3VL9D;
557557 ENABLE_PREVIEWS = YES;
558558 GENERATE_INFOPLIST_FILE = YES;
@@ -569,7 +569,7 @@
569569 "$(inherited)",
570570 "@executable_path/Frameworks",
571571 );
572 MARKETING_VERSION = 2.15.0;
572 MARKETING_VERSION = 2.15.1;
573573 PRODUCT_BUNDLE_IDENTIFIER = net.cleberg.Hutch;
574574 PRODUCT_NAME = "$(TARGET_NAME)";
575575 STRING_CATALOG_GENERATE_SYMBOLS = YES;
@@ -632,7 +632,7 @@
632632 APPLICATION_EXTENSION_API_ONLY = YES;
633633 CODE_SIGN_ENTITLEMENTS = HutchWidgetExtension/HutchWidgetExtension.entitlements;
634634 CODE_SIGN_STYLE = Automatic;
635 CURRENT_PROJECT_VERSION = 32;
635 CURRENT_PROJECT_VERSION = 33;
636636 DEVELOPMENT_TEAM = ZCNAX3VL9D;
637637 GENERATE_INFOPLIST_FILE = NO;
638638 INFOPLIST_FILE = HutchWidgetExtension/Info.plist;
@@ -642,7 +642,7 @@
642642 "@executable_path/Frameworks",
643643 "@executable_path/../../Frameworks",
644644 );
645 MARKETING_VERSION = 2.15.0;
645 MARKETING_VERSION = 2.15.1;
646646 PRODUCT_BUNDLE_IDENTIFIER = net.cleberg.Hutch.HutchWidgetExtension;
647647 PRODUCT_NAME = "$(TARGET_NAME)";
648648 SKIP_INSTALL = YES;
@@ -661,7 +661,7 @@
661661 APPLICATION_EXTENSION_API_ONLY = YES;
662662 CODE_SIGN_ENTITLEMENTS = HutchWidgetExtension/HutchWidgetExtension.entitlements;
663663 CODE_SIGN_STYLE = Automatic;
664 CURRENT_PROJECT_VERSION = 32;
664 CURRENT_PROJECT_VERSION = 33;
665665 DEVELOPMENT_TEAM = ZCNAX3VL9D;
666666 GENERATE_INFOPLIST_FILE = NO;
667667 INFOPLIST_FILE = HutchWidgetExtension/Info.plist;
@@ -671,7 +671,7 @@
671671 "@executable_path/Frameworks",
672672 "@executable_path/../../Frameworks",
673673 );
674 MARKETING_VERSION = 2.15.0;
674 MARKETING_VERSION = 2.15.1;
675675 PRODUCT_BUNDLE_IDENTIFIER = net.cleberg.Hutch.HutchWidgetExtension;
676676 PRODUCT_NAME = "$(TARGET_NAME)";
677677 SKIP_INSTALL = YES;
Hutch/Networking/HutchStatsService.swift −12
@@ -20,7 +20,6 @@ struct HutchStatsService: ContributionCalendarServing {
2020 }
2121
2222 func fetchContributionCalendar(actor: String, endingOn endDate: Date) async throws -> ContributionCalendarResponse {
23 debugLog("calendar request actor=\(actor) endDate=\(Self.rangeFormatter.string(from: endDate))")
2423 return try await fetch(
2524 path: "api/contributions/\(actor)",
2625 queryItems: trailingYearQueryItems(endingOn: endDate),
@@ -29,7 +28,6 @@ struct HutchStatsService: ContributionCalendarServing {
2928 }
3029
3130 func fetchContributionStats(actor: String, endingOn endDate: Date) async throws -> ContributionStatsResponse {
32 debugLog("stats request actor=\(actor) endDate=\(Self.rangeFormatter.string(from: endDate))")
3331 return try await fetch(
3432 path: "api/contributions/\(actor)/stats",
3533 queryItems: trailingYearQueryItems(endingOn: endDate),
@@ -53,17 +51,14 @@ struct HutchStatsService: ContributionCalendarServing {
5351 throw URLError(.badURL)
5452 }
5553
56 debugLog("request \(url.absoluteString)")
5754 let (data, response): (Data, URLResponse)
5855 do {
5956 (data, response) = try await session.data(from: url)
6057 } catch {
61 debugLog("network failure \(url.absoluteString) error=\(error.localizedDescription)")
6258 throw SRHTError.networkError(error)
6359 }
6460
6561 if let httpResponse = response as? HTTPURLResponse {
66 debugLog("response \(url.absoluteString) status=\(httpResponse.statusCode) bytes=\(data.count)")
6762 if !(200...299).contains(httpResponse.statusCode) {
6863 throw SRHTError.httpError(httpResponse.statusCode)
6964 }
@@ -72,8 +67,6 @@ struct HutchStatsService: ContributionCalendarServing {
7267 do {
7368 return try decoder.decode(responseType, from: data)
7469 } catch {
75 let preview = String(decoding: data.prefix(300), as: UTF8.self)
76 debugLog("decode failure \(url.absoluteString) error=\(error.localizedDescription) body=\(preview)")
7770 throw SRHTError.decodingError(error)
7871 }
7972 }
@@ -113,9 +106,4 @@ struct HutchStatsService: ContributionCalendarServing {
113106 return formatter
114107 }()
115108
116 private func debugLog(_ message: String) {
117#if DEBUG
118 print("[HutchStatsService] \(message)")
119#endif
120 }
121109}
Hutch/Views/Builds/BuildDetailViewModel.swift −4
@@ -315,8 +315,6 @@ final class BuildDetailViewModel {
315315 guard autoRefreshTask == nil else { return }
316316 guard shouldAutoRefresh else { return }
317317
318 print("Build auto-refresh started")
319
320318 autoRefreshTask = Task { [weak self] in
321319 while !Task.isCancelled {
322320 do {
@@ -336,7 +334,6 @@ final class BuildDetailViewModel {
336334
337335 autoRefreshTask.cancel()
338336 self.autoRefreshTask = nil
339 print("Build auto-refresh stopped")
340337 }
341338
342339 private var shouldAutoRefresh: Bool {
@@ -352,7 +349,6 @@ final class BuildDetailViewModel {
352349 return
353350 }
354351
355 print("Build refresh tick")
356352 await loadJob()
357353 await loadBuildLog()
358354 }
Hutch/Views/Lookup/ContributionCalendarViewModel.swift −12
@@ -116,8 +116,6 @@ final class ContributionCalendarViewModel {
116116 isLoading = true
117117 loadErrorMessage = nil
118118 defer { isLoading = false }
119 debugLog("load start actor=\(actor) endDate=\(selectedEndDate.formatted(date: .abbreviated, time: .omitted))")
120
121119 let fetchedCalendar: ContributionCalendarResponse?
122120 let fetchedStats: ContributionStatsResponse?
123121 var errors: [any Error] = []
@@ -147,11 +145,6 @@ final class ContributionCalendarViewModel {
147145 loadErrorMessage = errors.first?.userFacingMessage
148146 }
149147
150 debugLog(
151 "load complete actor=\(actor) endDate=\(selectedEndDate.formatted(date: .abbreviated, time: .omitted)) state=\(String(describing: displayState)) " +
152 "calendarDays=\(calendar?.days.count ?? 0) totalEvents=\(stats?.totalEvents ?? 0) " +
153 "indexingState=\(String(describing: effectiveIndexingState)) error=\(loadErrorMessage ?? "none")"
154 )
155148 }
156149
157150 func selectPreviousYear() async {
@@ -196,9 +189,4 @@ final class ContributionCalendarViewModel {
196189 return normalizedStartDate...normalizedEndDate
197190 }
198191
199 private func debugLog(_ message: String) {
200#if DEBUG
201 print("[ContributionCalendarViewModel] \(message)")
202#endif
203 }
204192}
Hutch/Views/Lookup/LookupView.swift −4
@@ -201,8 +201,6 @@ final class LookupViewModel {
201201 }
202202 """
203203
204 lookupLogger.debug("Looking up user profile for username: \(username, privacy: .public)")
205
206204 let result: Response
207205 do {
208206 result = try await client.execute(
@@ -225,8 +223,6 @@ final class LookupViewModel {
225223 throw error
226224 }
227225
228 lookupLogger.debug("User lookup succeeded for username: \(username, privacy: .public)")
229
230226 return .user(result.user)
231227 }
232228
Hutch/Views/Lookup/UserProfileViewModel.swift −16
@@ -85,8 +85,6 @@ final class UserProfileViewModel {
8585 defer { isLoadingContributions = false }
8686
8787 let resolvedEndDate = Calendar.contributionCalendar.startOfDay(for: endDate ?? Date())
88 debugLog("profile contributions start actor=\(actor) endDate=\(resolvedEndDate.formatted(date: .abbreviated, time: .omitted))")
89
9088 do {
9189 async let contributionCalendar = statsService.fetchContributionCalendar(actor: actor, endingOn: resolvedEndDate)
9290 async let contributionStats = statsService.fetchContributionStats(actor: actor, endingOn: resolvedEndDate)
@@ -96,17 +94,8 @@ final class UserProfileViewModel {
9694 if contributionDisplayState != .unavailable {
9795 contributionsError = nil
9896 }
99 debugLog(
100 "profile contributions complete actor=\(actor) endDate=\(resolvedEndDate.formatted(date: .abbreviated, time: .omitted)) " +
101 "state=\(String(describing: contributionDisplayState)) days=\(self.contributionCalendar?.days.count ?? 0) " +
102 "totalEvents=\(self.contributionStats?.totalEvents ?? 0) error=\(contributionsError ?? "none")"
103 )
10497 } catch {
10598 contributionsError = error.userFacingMessage
106 debugLog(
107 "profile contributions failed actor=\(actor) endDate=\(resolvedEndDate.formatted(date: .abbreviated, time: .omitted)) " +
108 "error=\(error.localizedDescription) userFacing=\(contributionsError ?? "none")"
109 )
11099 }
111100 }
112101
@@ -232,9 +221,4 @@ final class UserProfileViewModel {
232221 }
233222 }
234223
235 private func debugLog(_ message: String) {
236#if DEBUG
237 print("[UserProfileViewModel] \(message)")
238#endif
239 }
240224}