File tree Expand file tree Collapse file tree
project.xcworkspace/xcshareddata/swiftpm Expand file tree Collapse file tree Original file line number Diff line number Diff line change 12161216 repositoryURL = "https://github.com/getsentry/sentry-cocoa/";
12171217 requirement = {
12181218 kind = upToNextMajorVersion;
1219- minimumVersion = 8.50.1 ;
1219+ minimumVersion = 8.54.0 ;
12201220 };
12211221 };
12221222 A42271692DE78DEF002F03D5 /* XCRemoteSwiftPackageReference "faultordering" */ = {
Original file line number Diff line number Diff line change @@ -257,13 +257,13 @@ final class AppViewModel {
257257
258258 func loginSubmit( username: String , password: String ) async -> LoginStatus {
259259 let status = await webClient. login ( acct: username, pw: password)
260- print ( " Login Status: \( status) " )
260+ Logger . info ( " Login Status: \( status) " )
261261 switch status {
262262 case . success:
263263 showLoginSheet = false
264264 authState = . loggedIn
265265 case . error:
266- print ( " Login failed " )
266+ Logger . error ( " Login failed " )
267267 authState = . loggedOut
268268 }
269269 return status
Original file line number Diff line number Diff line change @@ -135,7 +135,7 @@ class CommentsViewModel {
135135 }
136136
137137 func fetchPage( ) async {
138- print ( " Fetching comments " )
138+ Logger . info ( " Fetching comments " )
139139 state. comments = . loading
140140 let page = await webClient. getStoryPage ( id: story. id)
141141 switch page {
@@ -158,7 +158,7 @@ class CommentsViewModel {
158158 func likePost( upvoted: Bool , url: String ) async {
159159 switch state. auth {
160160 case . loggedIn:
161- print ( " Like Post: \( url) " )
161+ Logger . info ( " Like Post: \( url) " )
162162 guard !url. isEmpty || upvoted else { return }
163163 state. headerState. upvoted = true
164164 await webClient. upvoteItem ( upvoteUrl: url)
@@ -181,7 +181,7 @@ class CommentsViewModel {
181181 comment
182182 }
183183 } )
184- print ( " Like Comment: \( data. upvoteUrl) " )
184+ Logger . info ( " Like Comment: \( data. upvoteUrl) " )
185185 await webClient. upvoteItem ( upvoteUrl: data. upvoteUrl)
186186 case . loggedOut:
187187 navigation ( . login)
Original file line number Diff line number Diff line change @@ -40,6 +40,7 @@ struct HackerNewsApp: App {
4040 options. enableAppHangTrackingV2 = true
4141 options. sessionReplay. onErrorSampleRate = 1.0
4242 options. sendDefaultPii = true
43+ options. experimental. enableLogs = true
4344
4445#if DEBUG
4546 options. environment = " development "
@@ -67,6 +68,7 @@ struct HackerNewsApp: App {
6768 options. environment = " xctest "
6869 }
6970 }
71+ Logger . info ( " App launched " )
7072 }
7173
7274 var body : some Scene {
Original file line number Diff line number Diff line change @@ -102,7 +102,7 @@ class HNWebClient {
102102 commentForm: commentFormData
103103 ) )
104104 } catch {
105- print ( " Error fetching post IDs: \( error) " )
105+ Logger . error ( " Error fetching post IDs: \( error) " )
106106 return . error
107107 }
108108 }
@@ -162,6 +162,7 @@ class HNWebClient {
162162 let comments = try document. comments ( )
163163 return comments
164164 } catch {
165+ Logger . error ( " Failed to post comment: \( error) " )
165166 return [ ]
166167 }
167168 }
Original file line number Diff line number Diff line change @@ -85,6 +85,7 @@ struct SendFeedbackScreen: View {
8585 source: . custom
8686 )
8787 SentrySDK . capture ( feedback: feedback)
88+ Logger . info ( " Feedback sent " )
8889
8990 withAnimation {
9091 isSubmitted = true
Original file line number Diff line number Diff line change @@ -34,7 +34,7 @@ struct StoryRow: View {
3434 } else {
3535 . storyComments( story: content. toStory ( ) )
3636 }
37- print ( " Navigating to \( destination) " )
37+ Logger . info ( " Navigating to \( destination) " )
3838 model. navigationPath. append ( destination)
3939 }
4040 } label: {
@@ -74,7 +74,7 @@ struct StoryRow: View {
7474 Spacer ( )
7575 // Comment Button
7676 Button ( action: {
77- print ( " Pressed comment button for: \( content. id) " )
77+ Logger . info ( " Pressed comment button for: \( content. id) " )
7878 model. navigationPath. append (
7979 AppViewModel . AppNavigation. storyComments (
8080 story: content. toStory ( ) )
Original file line number Diff line number Diff line change 1+ import Sentry
2+
3+ struct Logger {
4+ static func info( _ message: String ) {
5+ print ( message)
6+ SentrySDK . logger. info ( message)
7+ }
8+
9+ static func error( _ message: String ) {
10+ print ( message)
11+ SentrySDK . logger. error ( message)
12+ }
13+ }
Original file line number Diff line number Diff line change @@ -76,7 +76,7 @@ private final class DebugProtocol: URLProtocol {
7676 error: Error ? ,
7777 elapsed: Double
7878 ) {
79- let logger = Logger (
79+ let logger = os . Logger (
8080 subsystem: Bundle . main. bundleIdentifier ?? " NetworkDebug " ,
8181 category: " 🌐 "
8282 )
You can’t perform that action at this time.
0 commit comments