@fluidframework/telemetry-utils 1.4.0-121020 → 2.0.0-dev-rc.1.0.0.225277
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintrc.js +12 -13
- package/.mocharc.js +12 -0
- package/CHANGELOG.md +249 -0
- package/README.md +68 -1
- package/api-extractor-esm.json +5 -0
- package/api-extractor-lint.json +4 -0
- package/api-extractor.json +2 -2
- package/api-report/telemetry-utils.api.md +444 -0
- package/dist/config.d.ts +47 -16
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +88 -38
- package/dist/config.js.map +1 -1
- package/dist/error.d.ts +112 -0
- package/dist/error.d.ts.map +1 -0
- package/dist/error.js +159 -0
- package/dist/error.js.map +1 -0
- package/dist/errorLogging.d.ts +86 -20
- package/dist/errorLogging.d.ts.map +1 -1
- package/dist/errorLogging.js +190 -60
- package/dist/errorLogging.js.map +1 -1
- package/dist/eventEmitterWithErrorHandling.d.ts +9 -3
- package/dist/eventEmitterWithErrorHandling.d.ts.map +1 -1
- package/dist/eventEmitterWithErrorHandling.js +16 -3
- package/dist/eventEmitterWithErrorHandling.js.map +1 -1
- package/dist/events.d.ts +27 -3
- package/dist/events.d.ts.map +1 -1
- package/dist/events.js +26 -2
- package/dist/events.js.map +1 -1
- package/dist/fluidErrorBase.d.ts +57 -16
- package/dist/fluidErrorBase.d.ts.map +1 -1
- package/dist/fluidErrorBase.js +27 -14
- package/dist/fluidErrorBase.js.map +1 -1
- package/dist/index.d.ts +12 -11
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +55 -21
- package/dist/index.js.map +1 -1
- package/dist/logger.d.ts +269 -53
- package/dist/logger.d.ts.map +1 -1
- package/dist/logger.js +423 -132
- package/dist/logger.js.map +1 -1
- package/dist/mockLogger.d.ts +39 -12
- package/dist/mockLogger.d.ts.map +1 -1
- package/dist/mockLogger.js +105 -22
- package/dist/mockLogger.js.map +1 -1
- package/dist/sampledTelemetryHelper.d.ts +18 -12
- package/dist/sampledTelemetryHelper.d.ts.map +1 -1
- package/dist/sampledTelemetryHelper.js +28 -19
- package/dist/sampledTelemetryHelper.js.map +1 -1
- package/dist/telemetry-utils-alpha.d.ts +290 -0
- package/dist/telemetry-utils-beta.d.ts +264 -0
- package/dist/telemetry-utils-public.d.ts +264 -0
- package/dist/telemetry-utils-untrimmed.d.ts +1102 -0
- package/dist/telemetryTypes.d.ts +115 -0
- package/dist/telemetryTypes.d.ts.map +1 -0
- package/dist/telemetryTypes.js +7 -0
- package/dist/telemetryTypes.js.map +1 -0
- package/dist/thresholdCounter.d.ts +6 -5
- package/dist/thresholdCounter.d.ts.map +1 -1
- package/dist/thresholdCounter.js +4 -3
- package/dist/thresholdCounter.js.map +1 -1
- package/dist/tsdoc-metadata.json +11 -0
- package/dist/utils.d.ts +54 -3
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js +58 -3
- package/dist/utils.js.map +1 -1
- package/lib/config.d.ts +47 -16
- package/lib/config.d.ts.map +1 -1
- package/lib/config.js +85 -36
- package/lib/config.js.map +1 -1
- package/lib/error.d.ts +112 -0
- package/lib/error.d.ts.map +1 -0
- package/lib/error.js +150 -0
- package/lib/error.js.map +1 -0
- package/lib/errorLogging.d.ts +86 -20
- package/lib/errorLogging.d.ts.map +1 -1
- package/lib/errorLogging.js +189 -60
- package/lib/errorLogging.js.map +1 -1
- package/lib/eventEmitterWithErrorHandling.d.ts +9 -3
- package/lib/eventEmitterWithErrorHandling.d.ts.map +1 -1
- package/lib/eventEmitterWithErrorHandling.js +15 -2
- package/lib/eventEmitterWithErrorHandling.js.map +1 -1
- package/lib/events.d.ts +27 -3
- package/lib/events.d.ts.map +1 -1
- package/lib/events.js +26 -2
- package/lib/events.js.map +1 -1
- package/lib/fluidErrorBase.d.ts +57 -16
- package/lib/fluidErrorBase.d.ts.map +1 -1
- package/lib/fluidErrorBase.js +27 -14
- package/lib/fluidErrorBase.js.map +1 -1
- package/lib/index.d.ts +12 -11
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +11 -11
- package/lib/index.js.map +1 -1
- package/lib/logger.d.ts +269 -53
- package/lib/logger.d.ts.map +1 -1
- package/lib/logger.js +415 -131
- package/lib/logger.js.map +1 -1
- package/lib/mockLogger.d.ts +39 -12
- package/lib/mockLogger.d.ts.map +1 -1
- package/lib/mockLogger.js +106 -23
- package/lib/mockLogger.js.map +1 -1
- package/lib/sampledTelemetryHelper.d.ts +18 -12
- package/lib/sampledTelemetryHelper.d.ts.map +1 -1
- package/lib/sampledTelemetryHelper.js +26 -17
- package/lib/sampledTelemetryHelper.js.map +1 -1
- package/lib/telemetry-utils-alpha.d.mts +290 -0
- package/lib/telemetry-utils-beta.d.mts +264 -0
- package/lib/telemetry-utils-public.d.mts +264 -0
- package/lib/telemetry-utils-untrimmed.d.mts +1102 -0
- package/lib/telemetryTypes.d.ts +115 -0
- package/lib/telemetryTypes.d.ts.map +1 -0
- package/lib/telemetryTypes.js +6 -0
- package/lib/telemetryTypes.js.map +1 -0
- package/lib/thresholdCounter.d.ts +6 -5
- package/lib/thresholdCounter.d.ts.map +1 -1
- package/lib/thresholdCounter.js +4 -3
- package/lib/thresholdCounter.js.map +1 -1
- package/lib/utils.d.ts +54 -3
- package/lib/utils.d.ts.map +1 -1
- package/lib/utils.js +56 -2
- package/lib/utils.js.map +1 -1
- package/package.json +86 -57
- package/prettier.config.cjs +8 -0
- package/src/config.ts +254 -189
- package/src/error.ts +235 -0
- package/src/errorLogging.ts +440 -290
- package/src/eventEmitterWithErrorHandling.ts +26 -14
- package/src/events.ts +54 -25
- package/src/fluidErrorBase.ts +94 -46
- package/src/index.ts +76 -17
- package/src/logger.ts +972 -505
- package/src/mockLogger.ts +225 -83
- package/src/sampledTelemetryHelper.ts +136 -128
- package/src/telemetryTypes.ts +140 -0
- package/src/thresholdCounter.ts +38 -37
- package/src/utils.ts +108 -17
- package/tsconfig.esnext.json +6 -6
- package/tsconfig.json +9 -13
- package/dist/debugLogger.d.ts +0 -39
- package/dist/debugLogger.d.ts.map +0 -1
- package/dist/debugLogger.js +0 -101
- package/dist/debugLogger.js.map +0 -1
- package/dist/packageVersion.d.ts +0 -9
- package/dist/packageVersion.d.ts.map +0 -1
- package/dist/packageVersion.js +0 -12
- package/dist/packageVersion.js.map +0 -1
- package/lib/debugLogger.d.ts +0 -39
- package/lib/debugLogger.d.ts.map +0 -1
- package/lib/debugLogger.js +0 -97
- package/lib/debugLogger.js.map +0 -1
- package/lib/packageVersion.d.ts +0 -9
- package/lib/packageVersion.d.ts.map +0 -1
- package/lib/packageVersion.js +0 -9
- package/lib/packageVersion.js.map +0 -1
- package/src/debugLogger.ts +0 -126
- package/src/packageVersion.ts +0 -9
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { ITelemetryBaseLogger, LogLevel, Tagged } from "@fluidframework/core-interfaces";
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* The categories FF uses when instrumenting the code.
|
|
10
|
+
*
|
|
11
|
+
* generic - Informational log event
|
|
12
|
+
*
|
|
13
|
+
* error - Error log event, ideally 0 of these are logged during a session
|
|
14
|
+
*
|
|
15
|
+
* performance - Includes duration, and often has _start, _end, or _cancel suffixes for activity tracking
|
|
16
|
+
* @public
|
|
17
|
+
*/
|
|
18
|
+
export type TelemetryEventCategory = "generic" | "error" | "performance";
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Property types that can be logged.
|
|
22
|
+
*
|
|
23
|
+
* @remarks
|
|
24
|
+
* Includes extra types beyond {@link @fluidframework/core-interfaces#TelemetryBaseEventPropertyType}, which must be
|
|
25
|
+
* converted before sending to a base logger.
|
|
26
|
+
* @public
|
|
27
|
+
*/
|
|
28
|
+
export type TelemetryEventPropertyTypeExt =
|
|
29
|
+
| string
|
|
30
|
+
| number
|
|
31
|
+
| boolean
|
|
32
|
+
| undefined
|
|
33
|
+
| (string | number | boolean)[]
|
|
34
|
+
| {
|
|
35
|
+
[key: string]: // Flat objects can have the same properties as the event itself
|
|
36
|
+
string | number | boolean | undefined | (string | number | boolean)[];
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* A property to be logged to telemetry containing both the value and a tag. Tags are generic strings that can be used
|
|
41
|
+
* to mark pieces of information that should be organized or handled differently by loggers in various first or third
|
|
42
|
+
* party scenarios. For example, tags are used to mark personal information that should not be stored in logs.
|
|
43
|
+
*
|
|
44
|
+
* @deprecated Use {@link @fluidframework/core-interfaces#Tagged}\<{@link TelemetryEventPropertyTypeExt}\>
|
|
45
|
+
* @internal
|
|
46
|
+
*/
|
|
47
|
+
export interface ITaggedTelemetryPropertyTypeExt {
|
|
48
|
+
value: TelemetryEventPropertyTypeExt;
|
|
49
|
+
tag: string;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* JSON-serializable properties, which will be logged with telemetry.
|
|
54
|
+
* @public
|
|
55
|
+
*/
|
|
56
|
+
export interface ITelemetryPropertiesExt {
|
|
57
|
+
[index: string]: TelemetryEventPropertyTypeExt | Tagged<TelemetryEventPropertyTypeExt>;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Interface for logging telemetry statements.
|
|
62
|
+
* @remarks May contain any number of properties that get serialized as json payload.
|
|
63
|
+
* @param category - category of the event, like "error", "performance", "generic", etc.
|
|
64
|
+
* @param eventName - name of the event.
|
|
65
|
+
*
|
|
66
|
+
* @internal
|
|
67
|
+
*/
|
|
68
|
+
export interface ITelemetryEventExt extends ITelemetryPropertiesExt {
|
|
69
|
+
category: string;
|
|
70
|
+
eventName: string;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Informational (non-error) telemetry event
|
|
75
|
+
* @remarks Maps to category = "generic"
|
|
76
|
+
* @public
|
|
77
|
+
*/
|
|
78
|
+
export interface ITelemetryGenericEventExt extends ITelemetryPropertiesExt {
|
|
79
|
+
eventName: string;
|
|
80
|
+
category?: TelemetryEventCategory;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* Error telemetry event.
|
|
85
|
+
* @remarks Maps to category = "error"
|
|
86
|
+
* @public
|
|
87
|
+
*/
|
|
88
|
+
export interface ITelemetryErrorEventExt extends ITelemetryPropertiesExt {
|
|
89
|
+
eventName: string;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* Performance telemetry event.
|
|
94
|
+
* @remarks Maps to category = "performance"
|
|
95
|
+
* @public
|
|
96
|
+
*/
|
|
97
|
+
export interface ITelemetryPerformanceEventExt extends ITelemetryGenericEventExt {
|
|
98
|
+
duration?: number; // Duration of event (optional)
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* An extended {@link @fluidframework/core-interfaces#ITelemetryBaseLogger} which allows for more lenient event types.
|
|
103
|
+
*
|
|
104
|
+
* @remarks
|
|
105
|
+
* This interface is meant to be used internally within the Fluid Framework,
|
|
106
|
+
* and `ITelemetryBaseLogger` should be used when loggers are passed between layers.
|
|
107
|
+
* @public
|
|
108
|
+
*/
|
|
109
|
+
export interface ITelemetryLoggerExt extends ITelemetryBaseLogger {
|
|
110
|
+
/**
|
|
111
|
+
* Send information telemetry event
|
|
112
|
+
* @param event - Event to send
|
|
113
|
+
* @param error - optional error object to log
|
|
114
|
+
* @param logLevel - optional level of the log.
|
|
115
|
+
*/
|
|
116
|
+
sendTelemetryEvent(
|
|
117
|
+
event: ITelemetryGenericEventExt,
|
|
118
|
+
error?: unknown,
|
|
119
|
+
logLevel?: typeof LogLevel.verbose | typeof LogLevel.default,
|
|
120
|
+
): void;
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* Send error telemetry event
|
|
124
|
+
* @param event - Event to send
|
|
125
|
+
* @param error - optional error object to log
|
|
126
|
+
*/
|
|
127
|
+
sendErrorEvent(event: ITelemetryErrorEventExt, error?: unknown): void;
|
|
128
|
+
|
|
129
|
+
/**
|
|
130
|
+
* Send performance telemetry event
|
|
131
|
+
* @param event - Event to send
|
|
132
|
+
* @param error - optional error object to log
|
|
133
|
+
* @param logLevel - optional level of the log.
|
|
134
|
+
*/
|
|
135
|
+
sendPerformanceEvent(
|
|
136
|
+
event: ITelemetryPerformanceEventExt,
|
|
137
|
+
error?: unknown,
|
|
138
|
+
logLevel?: typeof LogLevel.verbose | typeof LogLevel.default,
|
|
139
|
+
): void;
|
|
140
|
+
}
|
package/src/thresholdCounter.ts
CHANGED
|
@@ -3,47 +3,48 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import {
|
|
6
|
+
import { ITelemetryLoggerExt } from "./telemetryTypes";
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
|
-
* Utility counter which will send event only if the provided value
|
|
10
|
-
*
|
|
9
|
+
* Utility counter which will send event only if the provided value is above a configured threshold.
|
|
10
|
+
*
|
|
11
|
+
* @internal
|
|
11
12
|
*/
|
|
12
13
|
export class ThresholdCounter {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
14
|
+
public constructor(
|
|
15
|
+
private readonly threshold: number,
|
|
16
|
+
private readonly logger: ITelemetryLoggerExt,
|
|
17
|
+
private thresholdMultiple = threshold,
|
|
18
|
+
) {}
|
|
18
19
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
20
|
+
/**
|
|
21
|
+
* Sends the value if it's above the treshold.
|
|
22
|
+
*/
|
|
23
|
+
public send(eventName: string, value: number): void {
|
|
24
|
+
if (value < this.threshold) {
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
this.logger.sendPerformanceEvent({
|
|
28
|
+
eventName,
|
|
29
|
+
value,
|
|
30
|
+
});
|
|
31
|
+
}
|
|
31
32
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
33
|
+
/**
|
|
34
|
+
* Sends the value if it's above the threshold
|
|
35
|
+
* and a multiple of the threshold.
|
|
36
|
+
*
|
|
37
|
+
* To be used in scenarios where we'd like to record a
|
|
38
|
+
* threshold violation while reducing telemetry noise.
|
|
39
|
+
*/
|
|
40
|
+
public sendIfMultiple(eventName: string, value: number): void {
|
|
41
|
+
if (value === this.thresholdMultiple) {
|
|
42
|
+
this.logger.sendPerformanceEvent({
|
|
43
|
+
eventName,
|
|
44
|
+
value,
|
|
45
|
+
});
|
|
46
|
+
// reduce number of "multiple" events.
|
|
47
|
+
this.thresholdMultiple = this.thresholdMultiple * 2;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
49
50
|
}
|
package/src/utils.ts
CHANGED
|
@@ -3,30 +3,121 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
} from "@fluidframework/
|
|
6
|
+
ITelemetryBaseEvent,
|
|
7
|
+
ITelemetryBaseLogger,
|
|
8
|
+
ITelemetryGenericEvent,
|
|
9
|
+
} from "@fluidframework/core-interfaces";
|
|
10
|
+
import { loggerToMonitoringContext } from "./config";
|
|
11
|
+
import { ITelemetryGenericEventExt, ITelemetryLoggerExt } from "./telemetryTypes";
|
|
10
12
|
|
|
11
13
|
/**
|
|
12
14
|
* Like assert, but logs only if the condition is false, rather than throwing
|
|
13
15
|
* @param condition - The condition to attest too
|
|
14
16
|
* @param logger - The logger to log with
|
|
15
17
|
* @param event - The string or event to log
|
|
16
|
-
* @returns
|
|
18
|
+
* @returns The outcome of the condition
|
|
19
|
+
*
|
|
20
|
+
* @internal
|
|
21
|
+
*
|
|
22
|
+
* @deprecated
|
|
23
|
+
* This API will be removed in a future release.
|
|
24
|
+
* No replacement API is intended, but reproducing its behavior should be trivial for anyone who needs it.
|
|
17
25
|
*/
|
|
18
26
|
export function logIfFalse(
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
27
|
+
condition: unknown,
|
|
28
|
+
logger: ITelemetryBaseLogger,
|
|
29
|
+
event: string | ITelemetryGenericEvent,
|
|
22
30
|
): condition is true {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
31
|
+
if (condition) {
|
|
32
|
+
return true;
|
|
33
|
+
}
|
|
34
|
+
const newEvent: ITelemetryBaseEvent =
|
|
35
|
+
typeof event === "string"
|
|
36
|
+
? { eventName: event, category: "error" }
|
|
37
|
+
: { category: "error", ...event };
|
|
38
|
+
logger.send(newEvent);
|
|
39
|
+
return false;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* An object that contains a callback used in conjunction with the {@link createSampledLogger} utility function to provide custom logic for sampling events.
|
|
44
|
+
*
|
|
45
|
+
* @internal
|
|
46
|
+
*/
|
|
47
|
+
export interface IEventSampler {
|
|
48
|
+
/**
|
|
49
|
+
* @returns true if the event should be sampled or false if not
|
|
50
|
+
*/
|
|
51
|
+
sample: () => boolean | undefined;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* A telemetry logger that has sampling capabilities
|
|
56
|
+
*
|
|
57
|
+
* @internal
|
|
58
|
+
*/
|
|
59
|
+
export interface ISampledTelemetryLogger extends ITelemetryLoggerExt {
|
|
60
|
+
/**
|
|
61
|
+
* Indicates if the feature flag to disable sampling is set.
|
|
62
|
+
*
|
|
63
|
+
* @remarks Exposed to enable some advanced scenarios where the code using the sampled logger
|
|
64
|
+
* could take advantage of skipping the execution of some logic when it can determine
|
|
65
|
+
* it won't be necessary because the telemetry event that needs it wouldn't be
|
|
66
|
+
* emitted anyway.
|
|
67
|
+
*/
|
|
68
|
+
isSamplingDisabled: boolean;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* Wraps around an existing logger matching the {@link ITelemetryLoggerExt} interface and provides the ability to only log a subset of events using a sampling strategy provided by an ${@link IEventSampler}.
|
|
73
|
+
* You can chose to not provide an event sampler which is effectively a no-op, meaning that it will be treated as if the sampler always returns true.
|
|
74
|
+
*
|
|
75
|
+
* @remarks
|
|
76
|
+
* The sampling functionality uses the Fluid telemetry logging configuration along with the optionally provided event sampling callback to determine whether an event should
|
|
77
|
+
* be logged or not.
|
|
78
|
+
*
|
|
79
|
+
* Configuration object parameters:
|
|
80
|
+
* 'Fluid.Telemetry.DisableSampling': if this config value is set to true, all events will be unsampled and therefore logged.
|
|
81
|
+
* Otherwise only a sample will be logged according to the provided event sampler callback.
|
|
82
|
+
*
|
|
83
|
+
* Note that the same sampler is used for all APIs of the returned logger. If you want separate events flowing through the returned logger to be sampled separately, the {@link IEventSampler} you provide should track them separately.
|
|
84
|
+
*
|
|
85
|
+
* @internal
|
|
86
|
+
*/
|
|
87
|
+
export function createSampledLogger(
|
|
88
|
+
logger: ITelemetryLoggerExt,
|
|
89
|
+
eventSampler?: IEventSampler,
|
|
90
|
+
): ISampledTelemetryLogger {
|
|
91
|
+
const monitoringContext = loggerToMonitoringContext(logger);
|
|
92
|
+
const isSamplingDisabled =
|
|
93
|
+
monitoringContext.config.getBoolean("Fluid.Telemetry.DisableSampling") ?? false;
|
|
94
|
+
|
|
95
|
+
const sampledLogger = {
|
|
96
|
+
send: (event: ITelemetryBaseEvent): void => {
|
|
97
|
+
// The sampler uses the following logic for sending events:
|
|
98
|
+
// 1. If isSamplingDisabled is true, then this means events should be unsampled. Therefore we send the event without any checks.
|
|
99
|
+
// 2. If isSamplingDisabled is false, then event should be sampled using the event sampler, if the sampler is not defined just send all events, other use the eventSampler.sample() method.
|
|
100
|
+
if (isSamplingDisabled || eventSampler === undefined || eventSampler.sample()) {
|
|
101
|
+
logger.send(event);
|
|
102
|
+
}
|
|
103
|
+
},
|
|
104
|
+
sendTelemetryEvent: (event: ITelemetryGenericEventExt): void => {
|
|
105
|
+
if (isSamplingDisabled || eventSampler === undefined || eventSampler.sample()) {
|
|
106
|
+
logger.sendTelemetryEvent(event);
|
|
107
|
+
}
|
|
108
|
+
},
|
|
109
|
+
sendErrorEvent: (event: ITelemetryGenericEventExt): void => {
|
|
110
|
+
if (isSamplingDisabled || eventSampler === undefined || eventSampler.sample()) {
|
|
111
|
+
logger.sendErrorEvent(event);
|
|
112
|
+
}
|
|
113
|
+
},
|
|
114
|
+
sendPerformanceEvent: (event: ITelemetryGenericEventExt): void => {
|
|
115
|
+
if (isSamplingDisabled || eventSampler === undefined || eventSampler.sample()) {
|
|
116
|
+
logger.sendPerformanceEvent(event);
|
|
117
|
+
}
|
|
118
|
+
},
|
|
119
|
+
isSamplingDisabled,
|
|
120
|
+
};
|
|
121
|
+
|
|
122
|
+
return sampledLogger;
|
|
32
123
|
}
|
package/tsconfig.esnext.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
}
|
|
2
|
+
"extends": "./tsconfig.json",
|
|
3
|
+
"compilerOptions": {
|
|
4
|
+
"outDir": "./lib",
|
|
5
|
+
"module": "esnext",
|
|
6
|
+
},
|
|
7
|
+
}
|
package/tsconfig.json
CHANGED
|
@@ -1,14 +1,10 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
"include": [
|
|
12
|
-
"src/**/*"
|
|
13
|
-
]
|
|
14
|
-
}
|
|
2
|
+
"extends": "@fluidframework/build-common/ts-common-config.json",
|
|
3
|
+
"exclude": ["src/test/**/*"],
|
|
4
|
+
"compilerOptions": {
|
|
5
|
+
"rootDir": "./src",
|
|
6
|
+
"outDir": "./dist",
|
|
7
|
+
"composite": true,
|
|
8
|
+
},
|
|
9
|
+
"include": ["src/**/*"],
|
|
10
|
+
}
|
package/dist/debugLogger.d.ts
DELETED
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
-
* Licensed under the MIT License.
|
|
4
|
-
*/
|
|
5
|
-
import { ITelemetryBaseEvent, ITelemetryBaseLogger } from "@fluidframework/common-definitions";
|
|
6
|
-
import { IDebugger } from "debug";
|
|
7
|
-
import { TelemetryLogger, ITelemetryLoggerPropertyBags } from "./logger";
|
|
8
|
-
/**
|
|
9
|
-
* Implementation of debug logger
|
|
10
|
-
*/
|
|
11
|
-
export declare class DebugLogger extends TelemetryLogger {
|
|
12
|
-
private readonly debug;
|
|
13
|
-
private readonly debugErr;
|
|
14
|
-
/**
|
|
15
|
-
* Create debug logger - all events are output to debug npm library
|
|
16
|
-
* @param namespace - Telemetry event name prefix to add to all events
|
|
17
|
-
* @param properties - Base properties to add to all events
|
|
18
|
-
* @param propertyGetters - Getters to add additional properties to all events
|
|
19
|
-
*/
|
|
20
|
-
static create(namespace: string, properties?: ITelemetryLoggerPropertyBags): TelemetryLogger;
|
|
21
|
-
/**
|
|
22
|
-
* Mix in debug logger with another logger.
|
|
23
|
-
* Returned logger will output events to both newly created debug logger, as well as base logger
|
|
24
|
-
* @param namespace - Telemetry event name prefix to add to all events
|
|
25
|
-
* @param properties - Base properties to add to all events
|
|
26
|
-
* @param propertyGetters - Getters to add additional properties to all events
|
|
27
|
-
* @param baseLogger - Base logger to output events (in addition to debug logger being created). Can be undefined.
|
|
28
|
-
*/
|
|
29
|
-
static mixinDebugLogger(namespace: string, baseLogger?: ITelemetryBaseLogger, properties?: ITelemetryLoggerPropertyBags): TelemetryLogger;
|
|
30
|
-
private static tryGetBaseLoggerProps;
|
|
31
|
-
constructor(debug: IDebugger, debugErr: IDebugger, properties?: ITelemetryLoggerPropertyBags);
|
|
32
|
-
/**
|
|
33
|
-
* Send an event to debug loggers
|
|
34
|
-
*
|
|
35
|
-
* @param event - the event to send
|
|
36
|
-
*/
|
|
37
|
-
send(event: ITelemetryBaseEvent): void;
|
|
38
|
-
}
|
|
39
|
-
//# sourceMappingURL=debugLogger.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"debugLogger.d.ts","sourceRoot":"","sources":["../src/debugLogger.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACH,mBAAmB,EACnB,oBAAoB,EAEvB,MAAM,oCAAoC,CAAC;AAE5C,OAAO,EAA0B,SAAS,EAAE,MAAM,OAAO,CAAC;AAC1D,OAAO,EAAE,eAAe,EAAgC,4BAA4B,EAAE,MAAM,UAAU,CAAC;AAEvG;;GAEG;AACH,qBAAa,WAAY,SAAQ,eAAe;IAqDxC,OAAO,CAAC,QAAQ,CAAC,KAAK;IACtB,OAAO,CAAC,QAAQ,CAAC,QAAQ;IArD7B;;;;;OAKG;WACW,MAAM,CAChB,SAAS,EAAE,MAAM,EACjB,UAAU,CAAC,EAAE,4BAA4B,GAC1C,eAAe;IAWlB;;;;;;;OAOG;WACW,gBAAgB,CAC1B,SAAS,EAAE,MAAM,EACjB,UAAU,CAAC,EAAE,oBAAoB,EACjC,UAAU,CAAC,EAAE,4BAA4B,GAC1C,eAAe;IAYlB,OAAO,CAAC,MAAM,CAAC,qBAAqB;gBAQf,KAAK,EAAE,SAAS,EAChB,QAAQ,EAAE,SAAS,EACpC,UAAU,CAAC,EAAE,4BAA4B;IAK7C;;;;OAIG;IACI,IAAI,CAAC,KAAK,EAAE,mBAAmB,GAAG,IAAI;CA2ChD"}
|
package/dist/debugLogger.js
DELETED
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*!
|
|
3
|
-
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
4
|
-
* Licensed under the MIT License.
|
|
5
|
-
*/
|
|
6
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.DebugLogger = void 0;
|
|
8
|
-
const common_utils_1 = require("@fluidframework/common-utils");
|
|
9
|
-
const debug_1 = require("debug");
|
|
10
|
-
const logger_1 = require("./logger");
|
|
11
|
-
/**
|
|
12
|
-
* Implementation of debug logger
|
|
13
|
-
*/
|
|
14
|
-
class DebugLogger extends logger_1.TelemetryLogger {
|
|
15
|
-
constructor(debug, debugErr, properties) {
|
|
16
|
-
super(undefined, properties);
|
|
17
|
-
this.debug = debug;
|
|
18
|
-
this.debugErr = debugErr;
|
|
19
|
-
}
|
|
20
|
-
/**
|
|
21
|
-
* Create debug logger - all events are output to debug npm library
|
|
22
|
-
* @param namespace - Telemetry event name prefix to add to all events
|
|
23
|
-
* @param properties - Base properties to add to all events
|
|
24
|
-
* @param propertyGetters - Getters to add additional properties to all events
|
|
25
|
-
*/
|
|
26
|
-
static create(namespace, properties) {
|
|
27
|
-
// Setup base logger upfront, such that host can disable it (if needed)
|
|
28
|
-
const debug = (0, debug_1.debug)(namespace);
|
|
29
|
-
const debugErr = (0, debug_1.debug)(namespace);
|
|
30
|
-
debugErr.log = console.error.bind(console);
|
|
31
|
-
debugErr.enabled = true;
|
|
32
|
-
return new DebugLogger(debug, debugErr, properties);
|
|
33
|
-
}
|
|
34
|
-
/**
|
|
35
|
-
* Mix in debug logger with another logger.
|
|
36
|
-
* Returned logger will output events to both newly created debug logger, as well as base logger
|
|
37
|
-
* @param namespace - Telemetry event name prefix to add to all events
|
|
38
|
-
* @param properties - Base properties to add to all events
|
|
39
|
-
* @param propertyGetters - Getters to add additional properties to all events
|
|
40
|
-
* @param baseLogger - Base logger to output events (in addition to debug logger being created). Can be undefined.
|
|
41
|
-
*/
|
|
42
|
-
static mixinDebugLogger(namespace, baseLogger, properties) {
|
|
43
|
-
if (!baseLogger) {
|
|
44
|
-
return DebugLogger.create(namespace, properties);
|
|
45
|
-
}
|
|
46
|
-
const multiSinkLogger = new logger_1.MultiSinkLogger(undefined, properties);
|
|
47
|
-
multiSinkLogger.addLogger(DebugLogger.create(namespace, this.tryGetBaseLoggerProps(baseLogger)));
|
|
48
|
-
multiSinkLogger.addLogger(logger_1.ChildLogger.create(baseLogger, namespace));
|
|
49
|
-
return multiSinkLogger;
|
|
50
|
-
}
|
|
51
|
-
static tryGetBaseLoggerProps(baseLogger) {
|
|
52
|
-
if (baseLogger instanceof logger_1.TelemetryLogger) {
|
|
53
|
-
return baseLogger.properties;
|
|
54
|
-
}
|
|
55
|
-
return undefined;
|
|
56
|
-
}
|
|
57
|
-
/**
|
|
58
|
-
* Send an event to debug loggers
|
|
59
|
-
*
|
|
60
|
-
* @param event - the event to send
|
|
61
|
-
*/
|
|
62
|
-
send(event) {
|
|
63
|
-
const newEvent = this.prepareEvent(event);
|
|
64
|
-
const isError = newEvent.category === "error";
|
|
65
|
-
let logger = isError ? this.debugErr : this.debug;
|
|
66
|
-
// Use debug's coloring schema for base of the event
|
|
67
|
-
const index = event.eventName.lastIndexOf(logger_1.TelemetryLogger.eventNamespaceSeparator);
|
|
68
|
-
const name = event.eventName.substring(index + 1);
|
|
69
|
-
if (index > 0) {
|
|
70
|
-
logger = logger.extend(event.eventName.substring(0, index));
|
|
71
|
-
}
|
|
72
|
-
newEvent.eventName = undefined;
|
|
73
|
-
let tick = "";
|
|
74
|
-
tick = `tick=${logger_1.TelemetryLogger.formatTick(common_utils_1.performance.now())}`;
|
|
75
|
-
// Extract stack to put it last, but also to avoid escaping '\n' in it by JSON.stringify below
|
|
76
|
-
const stack = newEvent.stack ? newEvent.stack : "";
|
|
77
|
-
newEvent.stack = undefined;
|
|
78
|
-
// Watch out for circular references - they can come from two sources
|
|
79
|
-
// 1) error object - we do not control it and should remove it and retry
|
|
80
|
-
// 2) properties supplied by telemetry caller - that's a bug that should be addressed!
|
|
81
|
-
let payload;
|
|
82
|
-
try {
|
|
83
|
-
payload = JSON.stringify(newEvent);
|
|
84
|
-
}
|
|
85
|
-
catch (error) {
|
|
86
|
-
newEvent.error = undefined;
|
|
87
|
-
payload = JSON.stringify(newEvent);
|
|
88
|
-
}
|
|
89
|
-
if (payload === "{}") {
|
|
90
|
-
payload = "";
|
|
91
|
-
}
|
|
92
|
-
// Force errors out, to help with diagnostics
|
|
93
|
-
if (isError) {
|
|
94
|
-
logger.enabled = true;
|
|
95
|
-
}
|
|
96
|
-
// Print multi-line.
|
|
97
|
-
logger(`${name} ${payload} ${tick} ${stack}`);
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
exports.DebugLogger = DebugLogger;
|
|
101
|
-
//# sourceMappingURL=debugLogger.js.map
|
package/dist/debugLogger.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"debugLogger.js","sourceRoot":"","sources":["../src/debugLogger.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAOH,+DAA2D;AAC3D,iCAA0D;AAC1D,qCAAuG;AAEvG;;GAEG;AACH,MAAa,WAAY,SAAQ,wBAAe;IAoD5C,YACqB,KAAgB,EAChB,QAAmB,EACpC,UAAyC;QAEzC,KAAK,CAAC,SAAS,EAAE,UAAU,CAAC,CAAC;QAJZ,UAAK,GAAL,KAAK,CAAW;QAChB,aAAQ,GAAR,QAAQ,CAAW;IAIxC,CAAC;IAzDD;;;;;OAKG;IACI,MAAM,CAAC,MAAM,CAChB,SAAiB,EACjB,UAAyC;QAEzC,uEAAuE;QACvE,MAAM,KAAK,GAAG,IAAA,aAAa,EAAC,SAAS,CAAC,CAAC;QAEvC,MAAM,QAAQ,GAAG,IAAA,aAAa,EAAC,SAAS,CAAC,CAAC;QAC1C,QAAQ,CAAC,GAAG,GAAG,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QAC3C,QAAQ,CAAC,OAAO,GAAG,IAAI,CAAC;QAExB,OAAO,IAAI,WAAW,CAAC,KAAK,EAAE,QAAQ,EAAE,UAAU,CAAC,CAAC;IACxD,CAAC;IAED;;;;;;;OAOG;IACI,MAAM,CAAC,gBAAgB,CAC1B,SAAiB,EACjB,UAAiC,EACjC,UAAyC;QAEzC,IAAI,CAAC,UAAU,EAAE;YACb,OAAO,WAAW,CAAC,MAAM,CAAC,SAAS,EAAE,UAAU,CAAC,CAAC;SACpD;QAED,MAAM,eAAe,GAAG,IAAI,wBAAe,CAAC,SAAS,EAAE,UAAU,CAAC,CAAC;QACnE,eAAe,CAAC,SAAS,CAAC,WAAW,CAAC,MAAM,CAAC,SAAS,EAAE,IAAI,CAAC,qBAAqB,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;QACjG,eAAe,CAAC,SAAS,CAAC,oBAAW,CAAC,MAAM,CAAC,UAAU,EAAE,SAAS,CAAC,CAAC,CAAC;QAErE,OAAO,eAAe,CAAC;IAC3B,CAAC;IAEO,MAAM,CAAC,qBAAqB,CAAC,UAAiC;QAClE,IAAI,UAAU,YAAY,wBAAe,EAAE;YACvC,OAAQ,UAAmE,CAAC,UAAU,CAAC;SAC1F;QACD,OAAO,SAAS,CAAC;IACrB,CAAC;IAUD;;;;OAIG;IACI,IAAI,CAAC,KAA0B;QAClC,MAAM,QAAQ,GAAyB,IAAI,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC;QAChE,MAAM,OAAO,GAAG,QAAQ,CAAC,QAAQ,KAAK,OAAO,CAAC;QAC9C,IAAI,MAAM,GAAG,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC;QAElD,oDAAoD;QACpD,MAAM,KAAK,GAAG,KAAK,CAAC,SAAS,CAAC,WAAW,CAAC,wBAAe,CAAC,uBAAuB,CAAC,CAAC;QACnF,MAAM,IAAI,GAAG,KAAK,CAAC,SAAS,CAAC,SAAS,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC;QAClD,IAAI,KAAK,GAAG,CAAC,EAAE;YACX,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC;SAC/D;QACD,QAAQ,CAAC,SAAS,GAAG,SAAS,CAAC;QAE/B,IAAI,IAAI,GAAG,EAAE,CAAC;QACd,IAAI,GAAG,QAAQ,wBAAe,CAAC,UAAU,CAAC,0BAAW,CAAC,GAAG,EAAE,CAAC,EAAE,CAAC;QAE/D,8FAA8F;QAC9F,MAAM,KAAK,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC;QACnD,QAAQ,CAAC,KAAK,GAAG,SAAS,CAAC;QAE3B,qEAAqE;QACrE,wEAAwE;QACxE,sFAAsF;QACtF,IAAI,OAAe,CAAC;QACpB,IAAI;YACA,OAAO,GAAG,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC;SACtC;QAAC,OAAO,KAAK,EAAE;YACZ,QAAQ,CAAC,KAAK,GAAG,SAAS,CAAC;YAC3B,OAAO,GAAG,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC;SACtC;QAED,IAAI,OAAO,KAAK,IAAI,EAAE;YAClB,OAAO,GAAG,EAAE,CAAC;SAChB;QAED,6CAA6C;QAC7C,IAAI,OAAO,EAAE;YACT,MAAM,CAAC,OAAO,GAAG,IAAI,CAAC;SACzB;QAED,oBAAoB;QACpB,MAAM,CAAC,GAAG,IAAI,IAAI,OAAO,IAAI,IAAI,IAAI,KAAK,EAAE,CAAC,CAAC;IAClD,CAAC;CACJ;AA5GD,kCA4GC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport {\n ITelemetryBaseEvent,\n ITelemetryBaseLogger,\n ITelemetryProperties,\n} from \"@fluidframework/common-definitions\";\nimport { performance } from \"@fluidframework/common-utils\";\nimport { debug as registerDebug, IDebugger } from \"debug\";\nimport { TelemetryLogger, MultiSinkLogger, ChildLogger, ITelemetryLoggerPropertyBags } from \"./logger\";\n\n/**\n * Implementation of debug logger\n */\nexport class DebugLogger extends TelemetryLogger {\n /**\n * Create debug logger - all events are output to debug npm library\n * @param namespace - Telemetry event name prefix to add to all events\n * @param properties - Base properties to add to all events\n * @param propertyGetters - Getters to add additional properties to all events\n */\n public static create(\n namespace: string,\n properties?: ITelemetryLoggerPropertyBags,\n ): TelemetryLogger {\n // Setup base logger upfront, such that host can disable it (if needed)\n const debug = registerDebug(namespace);\n\n const debugErr = registerDebug(namespace);\n debugErr.log = console.error.bind(console);\n debugErr.enabled = true;\n\n return new DebugLogger(debug, debugErr, properties);\n }\n\n /**\n * Mix in debug logger with another logger.\n * Returned logger will output events to both newly created debug logger, as well as base logger\n * @param namespace - Telemetry event name prefix to add to all events\n * @param properties - Base properties to add to all events\n * @param propertyGetters - Getters to add additional properties to all events\n * @param baseLogger - Base logger to output events (in addition to debug logger being created). Can be undefined.\n */\n public static mixinDebugLogger(\n namespace: string,\n baseLogger?: ITelemetryBaseLogger,\n properties?: ITelemetryLoggerPropertyBags,\n ): TelemetryLogger {\n if (!baseLogger) {\n return DebugLogger.create(namespace, properties);\n }\n\n const multiSinkLogger = new MultiSinkLogger(undefined, properties);\n multiSinkLogger.addLogger(DebugLogger.create(namespace, this.tryGetBaseLoggerProps(baseLogger)));\n multiSinkLogger.addLogger(ChildLogger.create(baseLogger, namespace));\n\n return multiSinkLogger;\n }\n\n private static tryGetBaseLoggerProps(baseLogger?: ITelemetryBaseLogger) {\n if (baseLogger instanceof TelemetryLogger) {\n return (baseLogger as any as { properties: ITelemetryLoggerPropertyBags; }).properties;\n }\n return undefined;\n }\n\n constructor(\n private readonly debug: IDebugger,\n private readonly debugErr: IDebugger,\n properties?: ITelemetryLoggerPropertyBags,\n ) {\n super(undefined, properties);\n }\n\n /**\n * Send an event to debug loggers\n *\n * @param event - the event to send\n */\n public send(event: ITelemetryBaseEvent): void {\n const newEvent: ITelemetryProperties = this.prepareEvent(event);\n const isError = newEvent.category === \"error\";\n let logger = isError ? this.debugErr : this.debug;\n\n // Use debug's coloring schema for base of the event\n const index = event.eventName.lastIndexOf(TelemetryLogger.eventNamespaceSeparator);\n const name = event.eventName.substring(index + 1);\n if (index > 0) {\n logger = logger.extend(event.eventName.substring(0, index));\n }\n newEvent.eventName = undefined;\n\n let tick = \"\";\n tick = `tick=${TelemetryLogger.formatTick(performance.now())}`;\n\n // Extract stack to put it last, but also to avoid escaping '\\n' in it by JSON.stringify below\n const stack = newEvent.stack ? newEvent.stack : \"\";\n newEvent.stack = undefined;\n\n // Watch out for circular references - they can come from two sources\n // 1) error object - we do not control it and should remove it and retry\n // 2) properties supplied by telemetry caller - that's a bug that should be addressed!\n let payload: string;\n try {\n payload = JSON.stringify(newEvent);\n } catch (error) {\n newEvent.error = undefined;\n payload = JSON.stringify(newEvent);\n }\n\n if (payload === \"{}\") {\n payload = \"\";\n }\n\n // Force errors out, to help with diagnostics\n if (isError) {\n logger.enabled = true;\n }\n\n // Print multi-line.\n logger(`${name} ${payload} ${tick} ${stack}`);\n }\n}\n"]}
|
package/dist/packageVersion.d.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
-
* Licensed under the MIT License.
|
|
4
|
-
*
|
|
5
|
-
* THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY
|
|
6
|
-
*/
|
|
7
|
-
export declare const pkgName = "@fluidframework/telemetry-utils";
|
|
8
|
-
export declare const pkgVersion = "1.4.0-121020";
|
|
9
|
-
//# sourceMappingURL=packageVersion.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"packageVersion.d.ts","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,eAAO,MAAM,OAAO,oCAAoC,CAAC;AACzD,eAAO,MAAM,UAAU,iBAAiB,CAAC"}
|
package/dist/packageVersion.js
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*!
|
|
3
|
-
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
4
|
-
* Licensed under the MIT License.
|
|
5
|
-
*
|
|
6
|
-
* THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY
|
|
7
|
-
*/
|
|
8
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
-
exports.pkgVersion = exports.pkgName = void 0;
|
|
10
|
-
exports.pkgName = "@fluidframework/telemetry-utils";
|
|
11
|
-
exports.pkgVersion = "1.4.0-121020";
|
|
12
|
-
//# sourceMappingURL=packageVersion.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEU,QAAA,OAAO,GAAG,iCAAiC,CAAC;AAC5C,QAAA,UAAU,GAAG,cAAc,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n *\n * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY\n */\n\nexport const pkgName = \"@fluidframework/telemetry-utils\";\nexport const pkgVersion = \"1.4.0-121020\";\n"]}
|
package/lib/debugLogger.d.ts
DELETED
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
-
* Licensed under the MIT License.
|
|
4
|
-
*/
|
|
5
|
-
import { ITelemetryBaseEvent, ITelemetryBaseLogger } from "@fluidframework/common-definitions";
|
|
6
|
-
import { IDebugger } from "debug";
|
|
7
|
-
import { TelemetryLogger, ITelemetryLoggerPropertyBags } from "./logger";
|
|
8
|
-
/**
|
|
9
|
-
* Implementation of debug logger
|
|
10
|
-
*/
|
|
11
|
-
export declare class DebugLogger extends TelemetryLogger {
|
|
12
|
-
private readonly debug;
|
|
13
|
-
private readonly debugErr;
|
|
14
|
-
/**
|
|
15
|
-
* Create debug logger - all events are output to debug npm library
|
|
16
|
-
* @param namespace - Telemetry event name prefix to add to all events
|
|
17
|
-
* @param properties - Base properties to add to all events
|
|
18
|
-
* @param propertyGetters - Getters to add additional properties to all events
|
|
19
|
-
*/
|
|
20
|
-
static create(namespace: string, properties?: ITelemetryLoggerPropertyBags): TelemetryLogger;
|
|
21
|
-
/**
|
|
22
|
-
* Mix in debug logger with another logger.
|
|
23
|
-
* Returned logger will output events to both newly created debug logger, as well as base logger
|
|
24
|
-
* @param namespace - Telemetry event name prefix to add to all events
|
|
25
|
-
* @param properties - Base properties to add to all events
|
|
26
|
-
* @param propertyGetters - Getters to add additional properties to all events
|
|
27
|
-
* @param baseLogger - Base logger to output events (in addition to debug logger being created). Can be undefined.
|
|
28
|
-
*/
|
|
29
|
-
static mixinDebugLogger(namespace: string, baseLogger?: ITelemetryBaseLogger, properties?: ITelemetryLoggerPropertyBags): TelemetryLogger;
|
|
30
|
-
private static tryGetBaseLoggerProps;
|
|
31
|
-
constructor(debug: IDebugger, debugErr: IDebugger, properties?: ITelemetryLoggerPropertyBags);
|
|
32
|
-
/**
|
|
33
|
-
* Send an event to debug loggers
|
|
34
|
-
*
|
|
35
|
-
* @param event - the event to send
|
|
36
|
-
*/
|
|
37
|
-
send(event: ITelemetryBaseEvent): void;
|
|
38
|
-
}
|
|
39
|
-
//# sourceMappingURL=debugLogger.d.ts.map
|
package/lib/debugLogger.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"debugLogger.d.ts","sourceRoot":"","sources":["../src/debugLogger.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACH,mBAAmB,EACnB,oBAAoB,EAEvB,MAAM,oCAAoC,CAAC;AAE5C,OAAO,EAA0B,SAAS,EAAE,MAAM,OAAO,CAAC;AAC1D,OAAO,EAAE,eAAe,EAAgC,4BAA4B,EAAE,MAAM,UAAU,CAAC;AAEvG;;GAEG;AACH,qBAAa,WAAY,SAAQ,eAAe;IAqDxC,OAAO,CAAC,QAAQ,CAAC,KAAK;IACtB,OAAO,CAAC,QAAQ,CAAC,QAAQ;IArD7B;;;;;OAKG;WACW,MAAM,CAChB,SAAS,EAAE,MAAM,EACjB,UAAU,CAAC,EAAE,4BAA4B,GAC1C,eAAe;IAWlB;;;;;;;OAOG;WACW,gBAAgB,CAC1B,SAAS,EAAE,MAAM,EACjB,UAAU,CAAC,EAAE,oBAAoB,EACjC,UAAU,CAAC,EAAE,4BAA4B,GAC1C,eAAe;IAYlB,OAAO,CAAC,MAAM,CAAC,qBAAqB;gBAQf,KAAK,EAAE,SAAS,EAChB,QAAQ,EAAE,SAAS,EACpC,UAAU,CAAC,EAAE,4BAA4B;IAK7C;;;;OAIG;IACI,IAAI,CAAC,KAAK,EAAE,mBAAmB,GAAG,IAAI;CA2ChD"}
|