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 @@
515 ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; 515 ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
516 CODE_SIGN_ENTITLEMENTS = Hutch/Hutch.entitlements; 516 CODE_SIGN_ENTITLEMENTS = Hutch/Hutch.entitlements;
517 CODE_SIGN_STYLE = Automatic; 517 CODE_SIGN_STYLE = Automatic;
518 CURRENT_PROJECT_VERSION = 32; 518 CURRENT_PROJECT_VERSION = 33;
519 DEVELOPMENT_TEAM = ZCNAX3VL9D; 519 DEVELOPMENT_TEAM = ZCNAX3VL9D;
520 ENABLE_PREVIEWS = YES; 520 ENABLE_PREVIEWS = YES;
521 GENERATE_INFOPLIST_FILE = YES; 521 GENERATE_INFOPLIST_FILE = YES;
@@ -532,7 +532,7 @@
532 "$(inherited)", 532 "$(inherited)",
533 "@executable_path/Frameworks", 533 "@executable_path/Frameworks",
534 ); 534 );
535 MARKETING_VERSION = 2.15.0; 535 MARKETING_VERSION = 2.15.1;
536 PRODUCT_BUNDLE_IDENTIFIER = net.cleberg.Hutch; 536 PRODUCT_BUNDLE_IDENTIFIER = net.cleberg.Hutch;
537 PRODUCT_NAME = "$(TARGET_NAME)"; 537 PRODUCT_NAME = "$(TARGET_NAME)";
538 STRING_CATALOG_GENERATE_SYMBOLS = YES; 538 STRING_CATALOG_GENERATE_SYMBOLS = YES;
@@ -552,7 +552,7 @@
552 ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; 552 ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
553 CODE_SIGN_ENTITLEMENTS = Hutch/Hutch.entitlements; 553 CODE_SIGN_ENTITLEMENTS = Hutch/Hutch.entitlements;
554 CODE_SIGN_STYLE = Automatic; 554 CODE_SIGN_STYLE = Automatic;
555 CURRENT_PROJECT_VERSION = 32; 555 CURRENT_PROJECT_VERSION = 33;
556 DEVELOPMENT_TEAM = ZCNAX3VL9D; 556 DEVELOPMENT_TEAM = ZCNAX3VL9D;
557 ENABLE_PREVIEWS = YES; 557 ENABLE_PREVIEWS = YES;
558 GENERATE_INFOPLIST_FILE = YES; 558 GENERATE_INFOPLIST_FILE = YES;
@@ -569,7 +569,7 @@
569 "$(inherited)", 569 "$(inherited)",
570 "@executable_path/Frameworks", 570 "@executable_path/Frameworks",
571 ); 571 );
572 MARKETING_VERSION = 2.15.0; 572 MARKETING_VERSION = 2.15.1;
573 PRODUCT_BUNDLE_IDENTIFIER = net.cleberg.Hutch; 573 PRODUCT_BUNDLE_IDENTIFIER = net.cleberg.Hutch;
574 PRODUCT_NAME = "$(TARGET_NAME)"; 574 PRODUCT_NAME = "$(TARGET_NAME)";
575 STRING_CATALOG_GENERATE_SYMBOLS = YES; 575 STRING_CATALOG_GENERATE_SYMBOLS = YES;
@@ -632,7 +632,7 @@
632 APPLICATION_EXTENSION_API_ONLY = YES; 632 APPLICATION_EXTENSION_API_ONLY = YES;
633 CODE_SIGN_ENTITLEMENTS = HutchWidgetExtension/HutchWidgetExtension.entitlements; 633 CODE_SIGN_ENTITLEMENTS = HutchWidgetExtension/HutchWidgetExtension.entitlements;
634 CODE_SIGN_STYLE = Automatic; 634 CODE_SIGN_STYLE = Automatic;
635 CURRENT_PROJECT_VERSION = 32; 635 CURRENT_PROJECT_VERSION = 33;
636 DEVELOPMENT_TEAM = ZCNAX3VL9D; 636 DEVELOPMENT_TEAM = ZCNAX3VL9D;
637 GENERATE_INFOPLIST_FILE = NO; 637 GENERATE_INFOPLIST_FILE = NO;
638 INFOPLIST_FILE = HutchWidgetExtension/Info.plist; 638 INFOPLIST_FILE = HutchWidgetExtension/Info.plist;
@@ -642,7 +642,7 @@
642 "@executable_path/Frameworks", 642 "@executable_path/Frameworks",
643 "@executable_path/../../Frameworks", 643 "@executable_path/../../Frameworks",
644 ); 644 );
645 MARKETING_VERSION = 2.15.0; 645 MARKETING_VERSION = 2.15.1;
646 PRODUCT_BUNDLE_IDENTIFIER = net.cleberg.Hutch.HutchWidgetExtension; 646 PRODUCT_BUNDLE_IDENTIFIER = net.cleberg.Hutch.HutchWidgetExtension;
647 PRODUCT_NAME = "$(TARGET_NAME)"; 647 PRODUCT_NAME = "$(TARGET_NAME)";
648 SKIP_INSTALL = YES; 648 SKIP_INSTALL = YES;
@@ -661,7 +661,7 @@
661 APPLICATION_EXTENSION_API_ONLY = YES; 661 APPLICATION_EXTENSION_API_ONLY = YES;
662 CODE_SIGN_ENTITLEMENTS = HutchWidgetExtension/HutchWidgetExtension.entitlements; 662 CODE_SIGN_ENTITLEMENTS = HutchWidgetExtension/HutchWidgetExtension.entitlements;
663 CODE_SIGN_STYLE = Automatic; 663 CODE_SIGN_STYLE = Automatic;
664 CURRENT_PROJECT_VERSION = 32; 664 CURRENT_PROJECT_VERSION = 33;
665 DEVELOPMENT_TEAM = ZCNAX3VL9D; 665 DEVELOPMENT_TEAM = ZCNAX3VL9D;
666 GENERATE_INFOPLIST_FILE = NO; 666 GENERATE_INFOPLIST_FILE = NO;
667 INFOPLIST_FILE = HutchWidgetExtension/Info.plist; 667 INFOPLIST_FILE = HutchWidgetExtension/Info.plist;
@@ -671,7 +671,7 @@
671 "@executable_path/Frameworks", 671 "@executable_path/Frameworks",
672 "@executable_path/../../Frameworks", 672 "@executable_path/../../Frameworks",
673 ); 673 );
674 MARKETING_VERSION = 2.15.0; 674 MARKETING_VERSION = 2.15.1;
675 PRODUCT_BUNDLE_IDENTIFIER = net.cleberg.Hutch.HutchWidgetExtension; 675 PRODUCT_BUNDLE_IDENTIFIER = net.cleberg.Hutch.HutchWidgetExtension;
676 PRODUCT_NAME = "$(TARGET_NAME)"; 676 PRODUCT_NAME = "$(TARGET_NAME)";
677 SKIP_INSTALL = YES; 677 SKIP_INSTALL = YES;
Hutch/Networking/HutchStatsService.swift −12
@@ -20,7 +20,6 @@ struct HutchStatsService: ContributionCalendarServing {
20 } 20 }
21 21
22 func fetchContributionCalendar(actor: String, endingOn endDate: Date) async throws -> ContributionCalendarResponse { 22 func fetchContributionCalendar(actor: String, endingOn endDate: Date) async throws -> ContributionCalendarResponse {
23 debugLog("calendar request actor=\(actor) endDate=\(Self.rangeFormatter.string(from: endDate))")
24 return try await fetch( 23 return try await fetch(
25 path: "api/contributions/\(actor)", 24 path: "api/contributions/\(actor)",
26 queryItems: trailingYearQueryItems(endingOn: endDate), 25 queryItems: trailingYearQueryItems(endingOn: endDate),
@@ -29,7 +28,6 @@ struct HutchStatsService: ContributionCalendarServing {
29 } 28 }
30 29
31 func fetchContributionStats(actor: String, endingOn endDate: Date) async throws -> ContributionStatsResponse { 30 func fetchContributionStats(actor: String, endingOn endDate: Date) async throws -> ContributionStatsResponse {
32 debugLog("stats request actor=\(actor) endDate=\(Self.rangeFormatter.string(from: endDate))")
33 return try await fetch( 31 return try await fetch(
34 path: "api/contributions/\(actor)/stats", 32 path: "api/contributions/\(actor)/stats",
35 queryItems: trailingYearQueryItems(endingOn: endDate), 33 queryItems: trailingYearQueryItems(endingOn: endDate),
@@ -53,17 +51,14 @@ struct HutchStatsService: ContributionCalendarServing {
53 throw URLError(.badURL) 51 throw URLError(.badURL)
54 } 52 }
55 53
56 debugLog("request \(url.absoluteString)")
57 let (data, response): (Data, URLResponse) 54 let (data, response): (Data, URLResponse)
58 do { 55 do {
59 (data, response) = try await session.data(from: url) 56 (data, response) = try await session.data(from: url)
60 } catch { 57 } catch {
61 debugLog("network failure \(url.absoluteString) error=\(error.localizedDescription)")
62 throw SRHTError.networkError(error) 58 throw SRHTError.networkError(error)
63 } 59 }
64 60
65 if let httpResponse = response as? HTTPURLResponse { 61 if let httpResponse = response as? HTTPURLResponse {
66 debugLog("response \(url.absoluteString) status=\(httpResponse.statusCode) bytes=\(data.count)")
67 if !(200...299).contains(httpResponse.statusCode) { 62 if !(200...299).contains(httpResponse.statusCode) {
68 throw SRHTError.httpError(httpResponse.statusCode) 63 throw SRHTError.httpError(httpResponse.statusCode)
69 } 64 }
@@ -72,8 +67,6 @@ struct HutchStatsService: ContributionCalendarServing {
72 do { 67 do {
73 return try decoder.decode(responseType, from: data) 68 return try decoder.decode(responseType, from: data)
74 } catch { 69 } catch {
75 let preview = String(decoding: data.prefix(300), as: UTF8.self)
76 debugLog("decode failure \(url.absoluteString) error=\(error.localizedDescription) body=\(preview)")
77 throw SRHTError.decodingError(error) 70 throw SRHTError.decodingError(error)
78 } 71 }
79 } 72 }
@@ -113,9 +106,4 @@ struct HutchStatsService: ContributionCalendarServing {
113 return formatter 106 return formatter
114 }() 107 }()
115 108
116 private func debugLog(_ message: String) {
117#if DEBUG
118 print("[HutchStatsService] \(message)")
119#endif
120 }
121} 109}
Hutch/Views/Builds/BuildDetailViewModel.swift −4
@@ -315,8 +315,6 @@ final class BuildDetailViewModel {
315 guard autoRefreshTask == nil else { return } 315 guard autoRefreshTask == nil else { return }
316 guard shouldAutoRefresh else { return } 316 guard shouldAutoRefresh else { return }
317 317
318 print("Build auto-refresh started")
319
320 autoRefreshTask = Task { [weak self] in 318 autoRefreshTask = Task { [weak self] in
321 while !Task.isCancelled { 319 while !Task.isCancelled {
322 do { 320 do {
@@ -336,7 +334,6 @@ final class BuildDetailViewModel {
336 334
337 autoRefreshTask.cancel() 335 autoRefreshTask.cancel()
338 self.autoRefreshTask = nil 336 self.autoRefreshTask = nil
339 print("Build auto-refresh stopped")
340 } 337 }
341 338
342 private var shouldAutoRefresh: Bool { 339 private var shouldAutoRefresh: Bool {
@@ -352,7 +349,6 @@ final class BuildDetailViewModel {
352 return 349 return
353 } 350 }
354 351
355 print("Build refresh tick")
356 await loadJob() 352 await loadJob()
357 await loadBuildLog() 353 await loadBuildLog()
358 } 354 }
Hutch/Views/Lookup/ContributionCalendarViewModel.swift −12
@@ -116,8 +116,6 @@ final class ContributionCalendarViewModel {
116 isLoading = true 116 isLoading = true
117 loadErrorMessage = nil 117 loadErrorMessage = nil
118 defer { isLoading = false } 118 defer { isLoading = false }
119 debugLog("load start actor=\(actor) endDate=\(selectedEndDate.formatted(date: .abbreviated, time: .omitted))")
120
121 let fetchedCalendar: ContributionCalendarResponse? 119 let fetchedCalendar: ContributionCalendarResponse?
122 let fetchedStats: ContributionStatsResponse? 120 let fetchedStats: ContributionStatsResponse?
123 var errors: [any Error] = [] 121 var errors: [any Error] = []
@@ -147,11 +145,6 @@ final class ContributionCalendarViewModel {
147 loadErrorMessage = errors.first?.userFacingMessage 145 loadErrorMessage = errors.first?.userFacingMessage
148 } 146 }
149 147
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 )
155 } 148 }
156 149
157 func selectPreviousYear() async { 150 func selectPreviousYear() async {
@@ -196,9 +189,4 @@ final class ContributionCalendarViewModel {
196 return normalizedStartDate...normalizedEndDate 189 return normalizedStartDate...normalizedEndDate
197 } 190 }
198 191
199 private func debugLog(_ message: String) {
200#if DEBUG
201 print("[ContributionCalendarViewModel] \(message)")
202#endif
203 }
204} 192}
Hutch/Views/Lookup/LookupView.swift −4
@@ -201,8 +201,6 @@ final class LookupViewModel {
201 } 201 }
202 """ 202 """
203 203
204 lookupLogger.debug("Looking up user profile for username: \(username, privacy: .public)")
205
206 let result: Response 204 let result: Response
207 do { 205 do {
208 result = try await client.execute( 206 result = try await client.execute(
@@ -225,8 +223,6 @@ final class LookupViewModel {
225 throw error 223 throw error
226 } 224 }
227 225
228 lookupLogger.debug("User lookup succeeded for username: \(username, privacy: .public)")
229
230 return .user(result.user) 226 return .user(result.user)
231 } 227 }
232 228
Hutch/Views/Lookup/UserProfileViewModel.swift −16
@@ -85,8 +85,6 @@ final class UserProfileViewModel {
85 defer { isLoadingContributions = false } 85 defer { isLoadingContributions = false }
86 86
87 let resolvedEndDate = Calendar.contributionCalendar.startOfDay(for: endDate ?? Date()) 87 let resolvedEndDate = Calendar.contributionCalendar.startOfDay(for: endDate ?? Date())
88 debugLog("profile contributions start actor=\(actor) endDate=\(resolvedEndDate.formatted(date: .abbreviated, time: .omitted))")
89
90 do { 88 do {
91 async let contributionCalendar = statsService.fetchContributionCalendar(actor: actor, endingOn: resolvedEndDate) 89 async let contributionCalendar = statsService.fetchContributionCalendar(actor: actor, endingOn: resolvedEndDate)
92 async let contributionStats = statsService.fetchContributionStats(actor: actor, endingOn: resolvedEndDate) 90 async let contributionStats = statsService.fetchContributionStats(actor: actor, endingOn: resolvedEndDate)
@@ -96,17 +94,8 @@ final class UserProfileViewModel {
96 if contributionDisplayState != .unavailable { 94 if contributionDisplayState != .unavailable {
97 contributionsError = nil 95 contributionsError = nil
98 } 96 }
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 )
104 } catch { 97 } catch {
105 contributionsError = error.userFacingMessage 98 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 )
110 } 99 }
111 } 100 }
112 101
@@ -232,9 +221,4 @@ final class UserProfileViewModel {
232 } 221 }
233 } 222 }
234 223
235 private func debugLog(_ message: String) {
236#if DEBUG
237 print("[UserProfileViewModel] \(message)")
238#endif
239 }
240} 224}