3
3
const {
4
4
ArrayPrototypeJoin,
5
5
SafeSet,
6
- Symbol,
7
6
} = primordials ;
8
7
9
8
const { hasTracing } = internalBinding ( 'config' ) ;
10
- const kHandle = Symbol ( 'handle' ) ;
11
- const kEnabled = Symbol ( 'enabled' ) ;
12
- const kCategories = Symbol ( 'categories' ) ;
13
9
14
10
const kMaxTracingCount = 10 ;
15
11
@@ -33,16 +29,19 @@ const {
33
29
const enabledTracingObjects = new SafeSet ( ) ;
34
30
35
31
class Tracing {
32
+ #handle;
33
+ #categories;
34
+ #enabled = false ;
35
+
36
36
constructor ( categories ) {
37
- this [ kHandle ] = new CategorySet ( categories ) ;
38
- this [ kCategories ] = categories ;
39
- this [ kEnabled ] = false ;
37
+ this . #handle = new CategorySet ( categories ) ;
38
+ this . #categories = categories ;
40
39
}
41
40
42
41
enable ( ) {
43
- if ( ! this [ kEnabled ] ) {
44
- this [ kEnabled ] = true ;
45
- this [ kHandle ] . enable ( ) ;
42
+ if ( ! this . #enabled ) {
43
+ this . #enabled = true ;
44
+ this . #handle . enable ( ) ;
46
45
enabledTracingObjects . add ( this ) ;
47
46
if ( enabledTracingObjects . size > kMaxTracingCount ) {
48
47
process . emitWarning (
@@ -54,19 +53,19 @@ class Tracing {
54
53
}
55
54
56
55
disable ( ) {
57
- if ( this [ kEnabled ] ) {
58
- this [ kEnabled ] = false ;
59
- this [ kHandle ] . disable ( ) ;
56
+ if ( this . #enabled ) {
57
+ this . #enabled = false ;
58
+ this . #handle . disable ( ) ;
60
59
enabledTracingObjects . delete ( this ) ;
61
60
}
62
61
}
63
62
64
63
get enabled ( ) {
65
- return this [ kEnabled ] ;
64
+ return this . #enabled ;
66
65
}
67
66
68
67
get categories ( ) {
69
- return ArrayPrototypeJoin ( this [ kCategories ] , ',' ) ;
68
+ return ArrayPrototypeJoin ( this . #categories , ',' ) ;
70
69
}
71
70
72
71
[ customInspectSymbol ] ( depth , opts ) {
0 commit comments