Skip to content
This repository was archived by the owner on Apr 20, 2024. It is now read-only.

Commit 189820e

Browse files
committed
Add optional version in reports
1 parent 5d769f0 commit 189820e

File tree

3 files changed

+7
-1
lines changed

3 files changed

+7
-1
lines changed

Sources/Bugsnag/Bugsnag.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,7 @@ struct BugsnagUser: Encodable {
151151

152152
struct BugsnagApp: Encodable {
153153
let releaseStage: String
154+
let version: String?
154155
}
155156

156157
struct BugsnagMetaData: Encodable {

Sources/Bugsnag/BugsnagConfig.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,23 @@
11
public struct BugsnagConfig {
22
let apiKey: String
33
let releaseStage: String
4+
/// A version identifier, (eg. a git hash)
5+
let version: String?
46
let keyFilters: [String]
57
let shouldReport: Bool
68
let debug: Bool
79

810
public init(
911
apiKey: String,
1012
releaseStage: String,
13+
version: String? = nil,
1114
keyFilters: [String] = [],
1215
shouldReport: Bool = true,
1316
debug: Bool = false
1417
) {
1518
self.apiKey = apiKey
1619
self.releaseStage = releaseStage
20+
self.version = version
1721
self.keyFilters = keyFilters
1822
self.shouldReport = shouldReport
1923
self.debug = debug

Sources/Bugsnag/BugsnagReporter.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@ public struct BugsnagReporter: Service {
3030
}
3131

3232
app = BugsnagApp(
33-
releaseStage: config.releaseStage
33+
releaseStage: config.releaseStage,
34+
version: config.version
3435
)
3536
headers = .init([
3637
("Content-Type", "application/json"),

0 commit comments

Comments
 (0)