-
-
Notifications
You must be signed in to change notification settings - Fork 336
/
SentrySDK.h
150 lines (124 loc) · 4.79 KB
/
SentrySDK.h
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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
#import <Foundation/Foundation.h>
#import "SentryBreadcrumb.h"
#import "SentryDefines.h"
#import "SentryEvent.h"
#import "SentryHub.h"
#import "SentryOptions.h"
NS_ASSUME_NONNULL_BEGIN
// NS_SWIFT_NAME(SDK)
/**
"static api" for easy access to most common sentry sdk features
try `SentryHub` for advanced features
*/
@interface SentrySDK : NSObject
SENTRY_NO_INIT
/**
* Returns current hub
*/
+ (SentryHub *)currentHub;
/**
* This forces a crash, useful to test the SentryCrash integration
*/
+ (void)crash;
/**
* Sets current hub
*/
+ (void)setCurrentHub:(SentryHub *)hub;
/**
* Use [SentrySDK startWithOptionsObject] / SentrySDK.start(:) instead
* @deprecated
*/
+ (instancetype)initWithOptionsObject:(SentryOptions *)options NS_SWIFT_NAME(init(options:))
__attribute((deprecated(("Use startWithOptionsObject"))));
/**
* Use [SentrySDK startWithOptions] / SentrySDK.start(:) instead
* @deprecated
*/
+ (instancetype)initWithOptions:(NSDictionary<NSString *, id> *)optionsDict
NS_SWIFT_NAME(init(options:))__attribute((deprecated(("Use startWithOptions"))));
/**
* Inits and configures Sentry (SentryHub, SentryClient) and sets up all integrations.
*/
+ (void)startWithOptions:(NSDictionary<NSString *, id> *)optionsDict NS_SWIFT_NAME(start(options:));
/**
* Inits and configures Sentry (SentryHub, SentryClient) and sets up all integrations.
*/
+ (void)startWithOptionsObject:(SentryOptions *)options NS_SWIFT_NAME(start(options:));
/**
* Inits and configures Sentry (SentryHub, SentryClient) and sets up all integrations. Make sure to
* set a valid DSN otherwise.
*/
+ (void)startWithConfigureOptions:(void (^)(SentryOptions *options))configureOptions
NS_SWIFT_NAME(start(configureOptions:));
/**
* captures an event aka. sends an event to sentry
*
* uses default `SentryHub`
*
* USAGE: Create a `SentryEvent`, fill it up with data, and send it with this
* method.
*/
+ (NSString *_Nullable)captureEvent:(SentryEvent *)event NS_SWIFT_NAME(capture(event:));
+ (NSString *_Nullable)captureEvent:(SentryEvent *)event
withScope:(SentryScope *_Nullable)scope
NS_SWIFT_NAME(capture(event:scope:));
+ (NSString *_Nullable)captureEvent:(SentryEvent *)event
withScopeBlock:(void (^)(SentryScope *scope))block
NS_SWIFT_NAME(capture(event:block:));
/**
captures an error aka. sends an NSError to sentry.
uses default `SentryHub`
*/
+ (NSString *_Nullable)captureError:(NSError *)error NS_SWIFT_NAME(capture(error:));
+ (NSString *_Nullable)captureError:(NSError *)error
withScope:(SentryScope *_Nullable)scope
NS_SWIFT_NAME(capture(error:scope:));
+ (NSString *_Nullable)captureError:(NSError *)error
withScopeBlock:(void (^)(SentryScope *scope))block
NS_SWIFT_NAME(capture(error:block:));
/**
captures an exception aka. sends an NSException to sentry.
uses default `SentryHub`
*/
+ (NSString *_Nullable)captureException:(NSException *)exception NS_SWIFT_NAME(capture(exception:));
+ (NSString *_Nullable)captureException:(NSException *)exception
withScope:(SentryScope *_Nullable)scope
NS_SWIFT_NAME(capture(exception:scope:));
+ (NSString *_Nullable)captureException:(NSException *)exception
withScopeBlock:(void (^)(SentryScope *scope))block
NS_SWIFT_NAME(capture(exception:block:));
/**
captures a message aka. sends a string to sentry.
uses default `SentryHub`
*/
+ (NSString *_Nullable)captureMessage:(NSString *)message NS_SWIFT_NAME(capture(message:));
+ (NSString *_Nullable)captureMessage:(NSString *)message
withScope:(SentryScope *_Nullable)scope
NS_SWIFT_NAME(capture(message:scope:));
+ (NSString *_Nullable)captureMessage:(NSString *)message
withScopeBlock:(void (^)(SentryScope *scope))block
NS_SWIFT_NAME(capture(message:block:));
/**
* Adds a SentryBreadcrumb to the current Scope on the `currentHub`.
* If the total number of breadcrumbs exceeds the `max_breadcrumbs` setting, the
* oldest breadcrumb is removed.
*/
+ (void)addBreadcrumb:(SentryBreadcrumb *)crumb NS_SWIFT_NAME(addBreadcrumb(crumb:));
//- `configure_scope(callback)`: Calls a callback with a scope object that can
// be reconfigured. This is used to attach contextual data for future events in
// the same scope.
+ (void)configureScope:(void (^)(SentryScope *scope))callback;
/**
* Set logLevel for the current client default kSentryLogLevelError
*/
@property (nonatomic, class) SentryLogLevel logLevel;
/**
* Checks if the last program execution terminated with a crash.
*/
@property (nonatomic, class, readonly) BOOL crashedLastRun;
/**
* Set global user -> thus will be sent with every event
*/
+ (void)setUser:(SentryUser *_Nullable)user;
@end
NS_ASSUME_NONNULL_END