-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Expand file tree
/
Copy pathsubject.js
More file actions
32 lines (22 loc) · 1.13 KB
/
subject.js
File metadata and controls
32 lines (22 loc) · 1.13 KB
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
// only log attribute
Sentry.logger.info('log_before_any_scope', { log_attr: 'log_attr_1' });
Sentry.getGlobalScope().setAttributes({ global_scope_attr: true });
Sentry.getGlobalScope().setAttribute('array_attr', [1, 2, 3]);
// global scope, log attribute
Sentry.logger.info('log_after_global_scope', { log_attr: 'log_attr_2' });
Sentry.withIsolationScope(isolationScope => {
isolationScope.setAttribute('isolation_scope_1_attr', { value: 100, unit: 'millisecond' });
// global scope, isolation scope, log attribute
Sentry.logger.info('log_with_isolation_scope', { log_attr: 'log_attr_3' });
Sentry.withScope(scope => {
scope.setAttributes({ scope_attr: { value: 200, unit: 'millisecond' } });
// global scope, isolation scope, current scope attribute, log attribute
Sentry.logger.info('log_with_scope', { log_attr: 'log_attr_4' });
});
Sentry.withScope(scope2 => {
scope2.setAttribute('scope_2_attr', { value: 300, unit: 'millisecond' });
// global scope, isolation scope, current scope attribute, log attribute
Sentry.logger.info('log_with_scope_2', { log_attr: 'log_attr_5' });
});
});
Sentry.flush();