@fluidframework/telemetry-utils 2.11.0 → 2.13.0
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/CHANGELOG.md +8 -0
- package/dist/errorLogging.js +2 -2
- package/dist/errorLogging.js.map +1 -1
- package/dist/logger.d.ts.map +1 -1
- package/dist/logger.js +2 -5
- package/dist/logger.js.map +1 -1
- package/dist/mockLogger.d.ts.map +1 -1
- package/dist/mockLogger.js.map +1 -1
- package/lib/errorLogging.js +2 -2
- package/lib/errorLogging.js.map +1 -1
- package/lib/logger.d.ts.map +1 -1
- package/lib/logger.js +2 -5
- package/lib/logger.js.map +1 -1
- package/lib/mockLogger.d.ts.map +1 -1
- package/lib/mockLogger.js.map +1 -1
- package/package.json +9 -9
- package/src/errorLogging.ts +2 -2
- package/src/logger.ts +2 -5
- package/src/mockLogger.ts +6 -1
package/src/logger.ts
CHANGED
|
@@ -289,11 +289,10 @@ export abstract class TelemetryLogger implements ITelemetryLoggerExt {
|
|
|
289
289
|
}
|
|
290
290
|
for (const props of properties) {
|
|
291
291
|
if (props !== undefined) {
|
|
292
|
-
for (const key of Object.
|
|
292
|
+
for (const [key, getterOrValue] of Object.entries(props)) {
|
|
293
293
|
if (eventLike[key] !== undefined) {
|
|
294
294
|
continue;
|
|
295
295
|
}
|
|
296
|
-
const getterOrValue = props[key];
|
|
297
296
|
// If this throws, hopefully it is handled elsewhere
|
|
298
297
|
const value =
|
|
299
298
|
typeof getterOrValue === "function" ? getterOrValue() : getterOrValue;
|
|
@@ -326,8 +325,7 @@ export class TaggedLoggerAdapter implements ITelemetryBaseLogger {
|
|
|
326
325
|
category: eventWithTagsMaybe.category,
|
|
327
326
|
eventName: eventWithTagsMaybe.eventName,
|
|
328
327
|
};
|
|
329
|
-
for (const key of Object.
|
|
330
|
-
const taggableProp = eventWithTagsMaybe[key];
|
|
328
|
+
for (const [key, taggableProp] of Object.entries(eventWithTagsMaybe)) {
|
|
331
329
|
const { value, tag } =
|
|
332
330
|
typeof taggableProp === "object"
|
|
333
331
|
? taggableProp
|
|
@@ -944,7 +942,6 @@ export const tagData = <
|
|
|
944
942
|
// The ternary form is less legible in this case.
|
|
945
943
|
// eslint-disable-next-line unicorn/prefer-ternary
|
|
946
944
|
if (typeof value === "function") {
|
|
947
|
-
// eslint-disable-next-line @typescript-eslint/explicit-function-return-type
|
|
948
945
|
pv[key] = () => {
|
|
949
946
|
return { tag, value: value() };
|
|
950
947
|
};
|
package/src/mockLogger.ts
CHANGED
|
@@ -7,6 +7,7 @@ import {
|
|
|
7
7
|
type ITelemetryBaseEvent,
|
|
8
8
|
type ITelemetryBaseLogger,
|
|
9
9
|
LogLevel,
|
|
10
|
+
type Tagged,
|
|
10
11
|
} from "@fluidframework/core-interfaces";
|
|
11
12
|
import { assert } from "@fluidframework/core-utils/internal";
|
|
12
13
|
|
|
@@ -15,6 +16,7 @@ import type {
|
|
|
15
16
|
ITelemetryEventExt,
|
|
16
17
|
ITelemetryLoggerExt,
|
|
17
18
|
ITelemetryPropertiesExt,
|
|
19
|
+
TelemetryEventPropertyTypeExt,
|
|
18
20
|
} from "./telemetryTypes.js";
|
|
19
21
|
|
|
20
22
|
/**
|
|
@@ -334,7 +336,10 @@ function matchObjects(
|
|
|
334
336
|
expected: ITelemetryPropertiesExt,
|
|
335
337
|
): boolean {
|
|
336
338
|
for (const [expectedKey, expectedValue] of Object.entries(expected)) {
|
|
337
|
-
const actualValue
|
|
339
|
+
const actualValue:
|
|
340
|
+
| TelemetryEventPropertyTypeExt
|
|
341
|
+
| Tagged<TelemetryEventPropertyTypeExt>
|
|
342
|
+
| undefined = actual[expectedKey];
|
|
338
343
|
if (
|
|
339
344
|
!Array.isArray(expectedValue) &&
|
|
340
345
|
expectedValue !== null &&
|