File tree Expand file tree Collapse file tree 10 files changed +30
-13
lines changed
project.xcworkspace/xcshareddata/swiftpm Expand file tree Collapse file tree 10 files changed +30
-13
lines changed Original file line number Diff line number Diff line change 1216
1216
repositoryURL = "https://github.com/getsentry/sentry-cocoa/";
1217
1217
requirement = {
1218
1218
kind = upToNextMajorVersion;
1219
- minimumVersion = 8.50.1 ;
1219
+ minimumVersion = 8.54.0 ;
1220
1220
};
1221
1221
};
1222
1222
A42271692DE78DEF002F03D5 /* XCRemoteSwiftPackageReference "faultordering" */ = {
Original file line number Diff line number Diff line change @@ -257,13 +257,13 @@ final class AppViewModel {
257
257
258
258
func loginSubmit( username: String , password: String ) async -> LoginStatus {
259
259
let status = await webClient. login ( acct: username, pw: password)
260
- print ( " Login Status: \( status) " )
260
+ Logger . info ( " Login Status: \( status) " )
261
261
switch status {
262
262
case . success:
263
263
showLoginSheet = false
264
264
authState = . loggedIn
265
265
case . error:
266
- print ( " Login failed " )
266
+ Logger . error ( " Login failed " )
267
267
authState = . loggedOut
268
268
}
269
269
return status
Original file line number Diff line number Diff line change @@ -135,7 +135,7 @@ class CommentsViewModel {
135
135
}
136
136
137
137
func fetchPage( ) async {
138
- print ( " Fetching comments " )
138
+ Logger . info ( " Fetching comments " )
139
139
state. comments = . loading
140
140
let page = await webClient. getStoryPage ( id: story. id)
141
141
switch page {
@@ -158,7 +158,7 @@ class CommentsViewModel {
158
158
func likePost( upvoted: Bool , url: String ) async {
159
159
switch state. auth {
160
160
case . loggedIn:
161
- print ( " Like Post: \( url) " )
161
+ Logger . info ( " Like Post: \( url) " )
162
162
guard !url. isEmpty || upvoted else { return }
163
163
state. headerState. upvoted = true
164
164
await webClient. upvoteItem ( upvoteUrl: url)
@@ -181,7 +181,7 @@ class CommentsViewModel {
181
181
comment
182
182
}
183
183
} )
184
- print ( " Like Comment: \( data. upvoteUrl) " )
184
+ Logger . info ( " Like Comment: \( data. upvoteUrl) " )
185
185
await webClient. upvoteItem ( upvoteUrl: data. upvoteUrl)
186
186
case . loggedOut:
187
187
navigation ( . login)
Original file line number Diff line number Diff line change @@ -40,6 +40,7 @@ struct HackerNewsApp: App {
40
40
options. enableAppHangTrackingV2 = true
41
41
options. sessionReplay. onErrorSampleRate = 1.0
42
42
options. sendDefaultPii = true
43
+ options. experimental. enableLogs = true
43
44
44
45
#if DEBUG
45
46
options. environment = " development "
@@ -67,6 +68,7 @@ struct HackerNewsApp: App {
67
68
options. environment = " xctest "
68
69
}
69
70
}
71
+ Logger . info ( " App launched " )
70
72
}
71
73
72
74
var body : some Scene {
Original file line number Diff line number Diff line change @@ -102,7 +102,7 @@ class HNWebClient {
102
102
commentForm: commentFormData
103
103
) )
104
104
} catch {
105
- print ( " Error fetching post IDs: \( error) " )
105
+ Logger . error ( " Error fetching post IDs: \( error) " )
106
106
return . error
107
107
}
108
108
}
@@ -162,6 +162,7 @@ class HNWebClient {
162
162
let comments = try document. comments ( )
163
163
return comments
164
164
} catch {
165
+ Logger . error ( " Failed to post comment: \( error) " )
165
166
return [ ]
166
167
}
167
168
}
Original file line number Diff line number Diff line change @@ -85,6 +85,7 @@ struct SendFeedbackScreen: View {
85
85
source: . custom
86
86
)
87
87
SentrySDK . capture ( feedback: feedback)
88
+ Logger . info ( " Feedback sent " )
88
89
89
90
withAnimation {
90
91
isSubmitted = true
Original file line number Diff line number Diff line change @@ -34,7 +34,7 @@ struct StoryRow: View {
34
34
} else {
35
35
. storyComments( story: content. toStory ( ) )
36
36
}
37
- print ( " Navigating to \( destination) " )
37
+ Logger . info ( " Navigating to \( destination) " )
38
38
model. navigationPath. append ( destination)
39
39
}
40
40
} label: {
@@ -74,7 +74,7 @@ struct StoryRow: View {
74
74
Spacer ( )
75
75
// Comment Button
76
76
Button ( action: {
77
- print ( " Pressed comment button for: \( content. id) " )
77
+ Logger . info ( " Pressed comment button for: \( content. id) " )
78
78
model. navigationPath. append (
79
79
AppViewModel . AppNavigation. storyComments (
80
80
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 {
76
76
error: Error ? ,
77
77
elapsed: Double
78
78
) {
79
- let logger = Logger (
79
+ let logger = os . Logger (
80
80
subsystem: Bundle . main. bundleIdentifier ?? " NetworkDebug " ,
81
81
category: " 🌐 "
82
82
)
You can’t perform that action at this time.
0 commit comments