forked from getsentry/sentry-cocoa
-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathSentryDefines.h
144 lines (126 loc) · 4.15 KB
/
SentryDefines.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
#import <Foundation/Foundation.h>
#ifdef __cplusplus
# define SENTRY_EXTERN extern "C" __attribute__((visibility("default")))
#else
# define SENTRY_EXTERN extern __attribute__((visibility("default")))
#endif
#if TARGET_OS_IOS || TARGET_OS_TV
# define SENTRY_HAS_UIDEVICE 1
#else
# define SENTRY_HAS_UIDEVICE 0
#endif
#if SENTRY_HAS_UIDEVICE
# define SENTRY_HAS_UIKIT 1
#else
# define SENTRY_HAS_UIKIT 0
#endif
#define SENTRY_NO_INIT \
-(instancetype)init NS_UNAVAILABLE; \
+(instancetype) new NS_UNAVAILABLE;
@class SentryEvent, SentryBreadcrumb, SentrySamplingContext;
@protocol SentrySpan;
/**
* Block used for returning after a request finished
*/
typedef void (^SentryRequestFinished)(NSError *_Nullable error);
/**
* Block used for request operation finished, shouldDiscardEvent is YES if event
* should be deleted regardless if an error occurred or not
*/
typedef void (^SentryRequestOperationFinished)(
NSHTTPURLResponse *_Nullable response, NSError *_Nullable error);
/**
* Block can be used to mutate a breadcrumb before it's added to the scope.
* To avoid adding the breadcrumb altogether, return nil instead.
*/
typedef SentryBreadcrumb *_Nullable (^SentryBeforeBreadcrumbCallback)(
SentryBreadcrumb *_Nonnull breadcrumb);
/**
* Block can be used to mutate event before its send.
* To avoid sending the event altogether, return nil instead.
*/
typedef SentryEvent *_Nullable (^SentryBeforeSendEventCallback)(SentryEvent *_Nonnull event);
/**
* A callback to be notified when the last program execution terminated with a crash.
*/
typedef void (^SentryOnCrashedLastRunCallback)(SentryEvent *_Nonnull event);
/**
* Block can be used to determine if an event should be queued and stored
* locally. It will be tried to send again after next successful send. Note that
* this will only be called once the event is created and send manually. Once it
* has been queued once it will be discarded if it fails again.
*/
typedef BOOL (^SentryShouldQueueEvent)(
NSHTTPURLResponse *_Nullable response, NSError *_Nullable error);
/**
* Function pointer for a sampler callback.
*
* @param samplingContext context of the sampling.
*
* @return A sample rate that is >= 0.0 and <= 1.0 or NIL if no sampling decision has been taken..
* When returning a value out of range the SDK uses the default of 0.
*/
typedef NSNumber *_Nullable (^SentryTracesSamplerCallback)(
SentrySamplingContext *_Nonnull samplingContext);
/**
* Function pointer for span manipulation.
*
* @param span The span to be used.
*/
typedef void (^SentrySpanCallback)(id<SentrySpan> _Nullable span);
/**
* Loglevel
*/
typedef NS_ENUM(NSInteger, SentryLogLevel) {
kSentryLogLevelNone = 1,
kSentryLogLevelError,
kSentryLogLevelDebug,
kSentryLogLevelVerbose
};
/**
* Sentry level
*/
typedef NS_ENUM(NSUInteger, SentryLevel) {
// Defaults to None which doesn't get serialized
kSentryLevelNone = 0,
// Goes from Debug to Fatal so possible to: (level > Info) { .. }
kSentryLevelDebug = 1,
kSentryLevelInfo = 2,
kSentryLevelWarning = 3,
kSentryLevelError = 4,
kSentryLevelFatal = 5
};
/**
* Permission status
*/
typedef NS_ENUM(NSInteger, SentryPermissionStatus) {
kSentryPermissionStatusUnknown = 0,
kSentryPermissionStatusGranted,
kSentryPermissionStatusPartial,
kSentryPermissionStatusDenied
};
/**
* Static internal helper to convert enum to string
*/
static DEPRECATED_MSG_ATTRIBUTE(
"Use nameForSentryLevel() instead.") NSString *_Nonnull const SentryLevelNames[]
= {
@"none",
@"debug",
@"info",
@"warning",
@"error",
@"fatal",
};
static NSUInteger const defaultMaxBreadcrumbs = 100;
/**
* Transaction name source
*/
typedef NS_ENUM(NSInteger, SentryTransactionNameSource) {
kSentryTransactionNameSourceCustom = 0,
kSentryTransactionNameSourceUrl,
kSentryTransactionNameSourceRoute,
kSentryTransactionNameSourceView,
kSentryTransactionNameSourceComponent,
kSentryTransactionNameSourceTask
};