UNPKG

2.11 kBTypeScriptView Raw
1declare module "trace_events" {
2 /**
3 * The `Tracing` object is used to enable or disable tracing for sets of
4 * categories. Instances are created using the
5 * `trace_events.createTracing()` method.
6 *
7 * When created, the `Tracing` object is disabled. Calling the
8 * `tracing.enable()` method adds the categories to the set of enabled trace
9 * event categories. Calling `tracing.disable()` will remove the categories
10 * from the set of enabled trace event categories.
11 */
12 interface Tracing {
13 /**
14 * A comma-separated list of the trace event categories covered by this
15 * `Tracing` object.
16 */
17 readonly categories: string;
18
19 /**
20 * Disables this `Tracing` object.
21 *
22 * Only trace event categories _not_ covered by other enabled `Tracing`
23 * objects and _not_ specified by the `--trace-event-categories` flag
24 * will be disabled.
25 */
26 disable(): void;
27
28 /**
29 * Enables this `Tracing` object for the set of categories covered by
30 * the `Tracing` object.
31 */
32 enable(): void;
33
34 /**
35 * `true` only if the `Tracing` object has been enabled.
36 */
37 readonly enabled: boolean;
38 }
39
40 interface CreateTracingOptions {
41 /**
42 * An array of trace category names. Values included in the array are
43 * coerced to a string when possible. An error will be thrown if the
44 * value cannot be coerced.
45 */
46 categories: string[];
47 }
48
49 /**
50 * Creates and returns a Tracing object for the given set of categories.
51 */
52 function createTracing(options: CreateTracingOptions): Tracing;
53
54 /**
55 * Returns a comma-separated list of all currently-enabled trace event
56 * categories. The current set of enabled trace event categories is
57 * determined by the union of all currently-enabled `Tracing` objects and
58 * any categories enabled using the `--trace-event-categories` flag.
59 */
60 function getEnabledCategories(): string | undefined;
61}