-
Notifications
You must be signed in to change notification settings - Fork 2
/
Options+CaptureService.swift
82 lines (76 loc) · 2.97 KB
/
Options+CaptureService.swift
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
//
// Copyright © 2023 Embrace Mobile, Inc. All rights reserved.
//
import Foundation
import EmbraceCaptureService
import EmbraceCore
import EmbraceCommon
import EmbraceCrash
import EmbraceOTel
public extension Embrace.Options {
/// Convenience initializer for `Embrace.Options` that automatically includes the the default `CaptureServices` and `CrashReporter`,
/// You can see list of platform service defaults in ``CaptureServiceFactory.platformCaptureServices``.
///
/// If you wish to customize which `CaptureServices` and `CrashReporter` are installed, please refer to the `Embrace.Options`
/// initializer found in the `EmbraceCore` target.
///
/// - Parameters:
/// - appId: The `appId` of the project.
/// - appGroupId: The app group identifier used by the app, if any.
/// - platform: `Platform` in which the app will run. Defaults to `.iOS`.
/// - endpoints: `Embrace.Endpoints` instance.
/// - logLevel: `LogLevel` for Embrace console logs
/// - export: `OpenTelemetryExport` object to export telemetry outside of the Embrace backend.
@objc convenience init(
appId: String,
appGroupId: String? = nil,
platform: Platform = .default,
endpoints: Embrace.Endpoints? = nil,
logLevel: LogLevel = .default,
export: OpenTelemetryExport? = nil
) {
self.init(
appId: appId,
appGroupId: appGroupId,
platform: platform,
endpoints: endpoints,
captureServices: .automatic,
crashReporter: EmbraceCrashReporter(),
logLevel: logLevel,
export: export
)
}
/// Convenience initializer for `Embrace.Options` that automatically includes the the default `CaptureServices` and `CrashReporter`,
/// You can see list of platform service defaults in ``CaptureServiceFactory.platformCaptureServices``.
///
/// If you wish to customize which `CaptureServices` and `CrashReporter` are installed, please refer to the `Embrace.Options`
/// initializer found in the `EmbraceCore` target.
///
/// - Parameters:
/// - appId: The `appId` of the project.
/// - appGroupId: The app group identifier used by the app, if any.
/// - platform: `Platform` in which the app will run. Defaults to `.iOS`.
@objc convenience init(
appId: String,
appGroupId: String? = nil,
platform: Platform = .default
) {
self.init(
appId: appId,
appGroupId: appGroupId,
platform: platform,
captureServices: .automatic,
crashReporter: EmbraceCrashReporter()
)
}
}
extension Embrace.Options: ExpressibleByStringLiteral {
public convenience init(stringLiteral value: String) {
self.init(appId: value)
}
}
public extension Array where Element == CaptureService {
static var automatic: [CaptureService] {
return CaptureServiceFactory.platformCaptureServices
}
}