@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
package/dist/index.js
CHANGED
|
@@ -1,32 +1,66 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
-
}) : (function(o, m, k, k2) {
|
|
6
|
-
if (k2 === undefined) k2 = k;
|
|
7
|
-
o[k2] = m[k];
|
|
8
|
-
}));
|
|
9
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
10
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
11
|
-
};
|
|
12
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
-
exports.loggerToMonitoringContext = exports.mixinMonitoringContext = exports.sessionStorageConfigProvider = void 0;
|
|
3
|
+
exports.createSampledLogger = exports.logIfFalse = exports.SampledTelemetryHelper = exports.ThresholdCounter = exports.MockLogger = exports.TelemetryNullLogger = exports.TelemetryDataTag = exports.tagCodeArtifacts = exports.tagData = exports.TaggedLoggerAdapter = exports.PerformanceEvent = exports.numberFromString = exports.formatTick = exports.createMultiSinkLogger = exports.createChildLogger = exports.eventNamespaceSeparator = exports.isValidLegacyError = exports.isFluidError = exports.hasErrorInstanceId = exports.safeRaiseEvent = exports.raiseConnectedEvent = exports.disconnectedEventName = exports.connectedEventName = exports.EventEmitterWithErrorHandling = exports.wrapErrorAndLog = exports.wrapError = exports.overwriteStack = exports.normalizeError = exports.NORMALIZED_ERROR_TYPE = exports.LoggingError = exports.isTaggedTelemetryPropertyValue = exports.isILoggingError = exports.isExternalError = exports.getCircularReplacer = exports.generateStack = exports.generateErrorWithStack = exports.extractLogSafeErrorProperties = exports.validatePrecondition = exports.UsageError = exports.GenericError = exports.extractSafePropertiesFromMessage = exports.DataProcessingError = exports.DataCorruptionError = exports.loggerToMonitoringContext = exports.mixinMonitoringContext = exports.sessionStorageConfigProvider = exports.createChildMonitoringContext = void 0;
|
|
14
4
|
/*!
|
|
15
5
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
16
6
|
* Licensed under the MIT License.
|
|
17
7
|
*/
|
|
18
|
-
__exportStar(require("./debugLogger"), exports);
|
|
19
|
-
__exportStar(require("./errorLogging"), exports);
|
|
20
|
-
__exportStar(require("./eventEmitterWithErrorHandling"), exports);
|
|
21
|
-
__exportStar(require("./events"), exports);
|
|
22
|
-
__exportStar(require("./fluidErrorBase"), exports);
|
|
23
|
-
__exportStar(require("./logger"), exports);
|
|
24
|
-
__exportStar(require("./mockLogger"), exports);
|
|
25
|
-
__exportStar(require("./thresholdCounter"), exports);
|
|
26
|
-
__exportStar(require("./utils"), exports);
|
|
27
|
-
__exportStar(require("./sampledTelemetryHelper"), exports);
|
|
28
8
|
var config_1 = require("./config");
|
|
9
|
+
Object.defineProperty(exports, "createChildMonitoringContext", { enumerable: true, get: function () { return config_1.createChildMonitoringContext; } });
|
|
29
10
|
Object.defineProperty(exports, "sessionStorageConfigProvider", { enumerable: true, get: function () { return config_1.sessionStorageConfigProvider; } });
|
|
30
11
|
Object.defineProperty(exports, "mixinMonitoringContext", { enumerable: true, get: function () { return config_1.mixinMonitoringContext; } });
|
|
31
12
|
Object.defineProperty(exports, "loggerToMonitoringContext", { enumerable: true, get: function () { return config_1.loggerToMonitoringContext; } });
|
|
13
|
+
var error_1 = require("./error");
|
|
14
|
+
Object.defineProperty(exports, "DataCorruptionError", { enumerable: true, get: function () { return error_1.DataCorruptionError; } });
|
|
15
|
+
Object.defineProperty(exports, "DataProcessingError", { enumerable: true, get: function () { return error_1.DataProcessingError; } });
|
|
16
|
+
Object.defineProperty(exports, "extractSafePropertiesFromMessage", { enumerable: true, get: function () { return error_1.extractSafePropertiesFromMessage; } });
|
|
17
|
+
Object.defineProperty(exports, "GenericError", { enumerable: true, get: function () { return error_1.GenericError; } });
|
|
18
|
+
Object.defineProperty(exports, "UsageError", { enumerable: true, get: function () { return error_1.UsageError; } });
|
|
19
|
+
Object.defineProperty(exports, "validatePrecondition", { enumerable: true, get: function () { return error_1.validatePrecondition; } });
|
|
20
|
+
var errorLogging_1 = require("./errorLogging");
|
|
21
|
+
Object.defineProperty(exports, "extractLogSafeErrorProperties", { enumerable: true, get: function () { return errorLogging_1.extractLogSafeErrorProperties; } });
|
|
22
|
+
Object.defineProperty(exports, "generateErrorWithStack", { enumerable: true, get: function () { return errorLogging_1.generateErrorWithStack; } });
|
|
23
|
+
Object.defineProperty(exports, "generateStack", { enumerable: true, get: function () { return errorLogging_1.generateStack; } });
|
|
24
|
+
Object.defineProperty(exports, "getCircularReplacer", { enumerable: true, get: function () { return errorLogging_1.getCircularReplacer; } });
|
|
25
|
+
Object.defineProperty(exports, "isExternalError", { enumerable: true, get: function () { return errorLogging_1.isExternalError; } });
|
|
26
|
+
Object.defineProperty(exports, "isILoggingError", { enumerable: true, get: function () { return errorLogging_1.isILoggingError; } });
|
|
27
|
+
Object.defineProperty(exports, "isTaggedTelemetryPropertyValue", { enumerable: true, get: function () { return errorLogging_1.isTaggedTelemetryPropertyValue; } });
|
|
28
|
+
Object.defineProperty(exports, "LoggingError", { enumerable: true, get: function () { return errorLogging_1.LoggingError; } });
|
|
29
|
+
Object.defineProperty(exports, "NORMALIZED_ERROR_TYPE", { enumerable: true, get: function () { return errorLogging_1.NORMALIZED_ERROR_TYPE; } });
|
|
30
|
+
Object.defineProperty(exports, "normalizeError", { enumerable: true, get: function () { return errorLogging_1.normalizeError; } });
|
|
31
|
+
Object.defineProperty(exports, "overwriteStack", { enumerable: true, get: function () { return errorLogging_1.overwriteStack; } });
|
|
32
|
+
Object.defineProperty(exports, "wrapError", { enumerable: true, get: function () { return errorLogging_1.wrapError; } });
|
|
33
|
+
Object.defineProperty(exports, "wrapErrorAndLog", { enumerable: true, get: function () { return errorLogging_1.wrapErrorAndLog; } });
|
|
34
|
+
var eventEmitterWithErrorHandling_1 = require("./eventEmitterWithErrorHandling");
|
|
35
|
+
Object.defineProperty(exports, "EventEmitterWithErrorHandling", { enumerable: true, get: function () { return eventEmitterWithErrorHandling_1.EventEmitterWithErrorHandling; } });
|
|
36
|
+
var events_1 = require("./events");
|
|
37
|
+
Object.defineProperty(exports, "connectedEventName", { enumerable: true, get: function () { return events_1.connectedEventName; } });
|
|
38
|
+
Object.defineProperty(exports, "disconnectedEventName", { enumerable: true, get: function () { return events_1.disconnectedEventName; } });
|
|
39
|
+
Object.defineProperty(exports, "raiseConnectedEvent", { enumerable: true, get: function () { return events_1.raiseConnectedEvent; } });
|
|
40
|
+
Object.defineProperty(exports, "safeRaiseEvent", { enumerable: true, get: function () { return events_1.safeRaiseEvent; } });
|
|
41
|
+
var fluidErrorBase_1 = require("./fluidErrorBase");
|
|
42
|
+
Object.defineProperty(exports, "hasErrorInstanceId", { enumerable: true, get: function () { return fluidErrorBase_1.hasErrorInstanceId; } });
|
|
43
|
+
Object.defineProperty(exports, "isFluidError", { enumerable: true, get: function () { return fluidErrorBase_1.isFluidError; } });
|
|
44
|
+
Object.defineProperty(exports, "isValidLegacyError", { enumerable: true, get: function () { return fluidErrorBase_1.isValidLegacyError; } });
|
|
45
|
+
var logger_1 = require("./logger");
|
|
46
|
+
Object.defineProperty(exports, "eventNamespaceSeparator", { enumerable: true, get: function () { return logger_1.eventNamespaceSeparator; } });
|
|
47
|
+
Object.defineProperty(exports, "createChildLogger", { enumerable: true, get: function () { return logger_1.createChildLogger; } });
|
|
48
|
+
Object.defineProperty(exports, "createMultiSinkLogger", { enumerable: true, get: function () { return logger_1.createMultiSinkLogger; } });
|
|
49
|
+
Object.defineProperty(exports, "formatTick", { enumerable: true, get: function () { return logger_1.formatTick; } });
|
|
50
|
+
Object.defineProperty(exports, "numberFromString", { enumerable: true, get: function () { return logger_1.numberFromString; } });
|
|
51
|
+
Object.defineProperty(exports, "PerformanceEvent", { enumerable: true, get: function () { return logger_1.PerformanceEvent; } });
|
|
52
|
+
Object.defineProperty(exports, "TaggedLoggerAdapter", { enumerable: true, get: function () { return logger_1.TaggedLoggerAdapter; } });
|
|
53
|
+
Object.defineProperty(exports, "tagData", { enumerable: true, get: function () { return logger_1.tagData; } });
|
|
54
|
+
Object.defineProperty(exports, "tagCodeArtifacts", { enumerable: true, get: function () { return logger_1.tagCodeArtifacts; } });
|
|
55
|
+
Object.defineProperty(exports, "TelemetryDataTag", { enumerable: true, get: function () { return logger_1.TelemetryDataTag; } });
|
|
56
|
+
Object.defineProperty(exports, "TelemetryNullLogger", { enumerable: true, get: function () { return logger_1.TelemetryNullLogger; } });
|
|
57
|
+
var mockLogger_1 = require("./mockLogger");
|
|
58
|
+
Object.defineProperty(exports, "MockLogger", { enumerable: true, get: function () { return mockLogger_1.MockLogger; } });
|
|
59
|
+
var thresholdCounter_1 = require("./thresholdCounter");
|
|
60
|
+
Object.defineProperty(exports, "ThresholdCounter", { enumerable: true, get: function () { return thresholdCounter_1.ThresholdCounter; } });
|
|
61
|
+
var sampledTelemetryHelper_1 = require("./sampledTelemetryHelper");
|
|
62
|
+
Object.defineProperty(exports, "SampledTelemetryHelper", { enumerable: true, get: function () { return sampledTelemetryHelper_1.SampledTelemetryHelper; } });
|
|
63
|
+
var utils_1 = require("./utils");
|
|
64
|
+
Object.defineProperty(exports, "logIfFalse", { enumerable: true, get: function () { return utils_1.logIfFalse; } });
|
|
65
|
+
Object.defineProperty(exports, "createSampledLogger", { enumerable: true, get: function () { return utils_1.createSampledLogger; } });
|
|
32
66
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA;;;GAGG;AACH,mCAOkB;AANjB,sHAAA,4BAA4B,OAAA;AAE5B,sHAAA,4BAA4B,OAAA;AAC5B,gHAAA,sBAAsB,OAAA;AAEtB,mHAAA,yBAAyB,OAAA;AAE1B,iCAOiB;AANhB,4GAAA,mBAAmB,OAAA;AACnB,4GAAA,mBAAmB,OAAA;AACnB,yHAAA,gCAAgC,OAAA;AAChC,qGAAA,YAAY,OAAA;AACZ,mGAAA,UAAU,OAAA;AACV,6GAAA,oBAAoB,OAAA;AAErB,+CAewB;AAdvB,6HAAA,6BAA6B,OAAA;AAC7B,sHAAA,sBAAsB,OAAA;AACtB,6GAAA,aAAa,OAAA;AACb,mHAAA,mBAAmB,OAAA;AAEnB,+GAAA,eAAe,OAAA;AACf,+GAAA,eAAe,OAAA;AACf,8HAAA,8BAA8B,OAAA;AAC9B,4GAAA,YAAY,OAAA;AACZ,qHAAA,qBAAqB,OAAA;AACrB,8GAAA,cAAc,OAAA;AACd,8GAAA,cAAc,OAAA;AACd,yGAAA,SAAS,OAAA;AACT,+GAAA,eAAe,OAAA;AAEhB,iFAAgF;AAAvE,8IAAA,6BAA6B,OAAA;AACtC,mCAKkB;AAJjB,4GAAA,kBAAkB,OAAA;AAClB,+GAAA,qBAAqB,OAAA;AACrB,6GAAA,mBAAmB,OAAA;AACnB,wGAAA,cAAc,OAAA;AAEf,mDAK0B;AAJzB,oHAAA,kBAAkB,OAAA;AAElB,8GAAA,YAAY,OAAA;AACZ,oHAAA,kBAAkB,OAAA;AAEnB,mCAiBkB;AAhBjB,iHAAA,uBAAuB,OAAA;AACvB,2GAAA,iBAAiB,OAAA;AACjB,+GAAA,qBAAqB,OAAA;AACrB,oGAAA,UAAU,OAAA;AAKV,0GAAA,gBAAgB,OAAA;AAChB,0GAAA,gBAAgB,OAAA;AAChB,6GAAA,mBAAmB,OAAA;AACnB,iGAAA,OAAO,OAAA;AACP,0GAAA,gBAAgB,OAAA;AAChB,0GAAA,gBAAgB,OAAA;AAEhB,6GAAA,mBAAmB,OAAA;AAEpB,2CAA0C;AAAjC,wGAAA,UAAU,OAAA;AACnB,uDAAsD;AAA7C,oHAAA,gBAAgB,OAAA;AACzB,mEAAkE;AAAzD,gIAAA,sBAAsB,OAAA;AAC/B,iCAAkG;AAAzF,mGAAA,UAAU,OAAA;AAAE,4GAAA,mBAAmB,OAAA","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\nexport {\n\tcreateChildMonitoringContext,\n\tMonitoringContext,\n\tsessionStorageConfigProvider,\n\tmixinMonitoringContext,\n\tIConfigProvider,\n\tloggerToMonitoringContext,\n} from \"./config\";\nexport {\n\tDataCorruptionError,\n\tDataProcessingError,\n\textractSafePropertiesFromMessage,\n\tGenericError,\n\tUsageError,\n\tvalidatePrecondition,\n} from \"./error\";\nexport {\n\textractLogSafeErrorProperties,\n\tgenerateErrorWithStack,\n\tgenerateStack,\n\tgetCircularReplacer,\n\tIFluidErrorAnnotations,\n\tisExternalError,\n\tisILoggingError,\n\tisTaggedTelemetryPropertyValue,\n\tLoggingError,\n\tNORMALIZED_ERROR_TYPE,\n\tnormalizeError,\n\toverwriteStack,\n\twrapError,\n\twrapErrorAndLog,\n} from \"./errorLogging\";\nexport { EventEmitterWithErrorHandling } from \"./eventEmitterWithErrorHandling\";\nexport {\n\tconnectedEventName,\n\tdisconnectedEventName,\n\traiseConnectedEvent,\n\tsafeRaiseEvent,\n} from \"./events\";\nexport {\n\thasErrorInstanceId,\n\tIFluidErrorBase,\n\tisFluidError,\n\tisValidLegacyError,\n} from \"./fluidErrorBase\";\nexport {\n\teventNamespaceSeparator,\n\tcreateChildLogger,\n\tcreateMultiSinkLogger,\n\tformatTick,\n\tIPerformanceEventMarkers,\n\tITelemetryLoggerPropertyBag,\n\tITelemetryLoggerPropertyBags,\n\tMultiSinkLoggerProperties,\n\tnumberFromString,\n\tPerformanceEvent,\n\tTaggedLoggerAdapter,\n\ttagData,\n\ttagCodeArtifacts,\n\tTelemetryDataTag,\n\tTelemetryEventPropertyTypes,\n\tTelemetryNullLogger,\n} from \"./logger\";\nexport { MockLogger } from \"./mockLogger\";\nexport { ThresholdCounter } from \"./thresholdCounter\";\nexport { SampledTelemetryHelper } from \"./sampledTelemetryHelper\";\nexport { logIfFalse, createSampledLogger, IEventSampler, ISampledTelemetryLogger } from \"./utils\";\nexport {\n\tTelemetryEventPropertyTypeExt,\n\tITelemetryEventExt,\n\tITelemetryGenericEventExt,\n\tITelemetryErrorEventExt,\n\tITelemetryPerformanceEventExt,\n\tITelemetryLoggerExt,\n\tITaggedTelemetryPropertyTypeExt,\n\tITelemetryPropertiesExt,\n\tTelemetryEventCategory,\n} from \"./telemetryTypes\";\n"]}
|
package/dist/logger.d.ts
CHANGED
|
@@ -2,47 +2,81 @@
|
|
|
2
2
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
|
-
import { ITelemetryBaseEvent, ITelemetryBaseLogger, ITelemetryErrorEvent, ITelemetryGenericEvent,
|
|
5
|
+
import { ITelemetryBaseEvent, ITelemetryBaseLogger, ITelemetryErrorEvent, ITelemetryGenericEvent, ITelemetryPerformanceEvent, TelemetryBaseEventPropertyType as TelemetryEventPropertyType, LogLevel, Tagged, ITelemetryBaseProperties, TelemetryBaseEventPropertyType } from "@fluidframework/core-interfaces";
|
|
6
|
+
import { IsomorphicPerformance } from "@fluid-internal/client-utils";
|
|
7
|
+
import { ITelemetryGenericEventExt, ITelemetryLoggerExt, ITelemetryPerformanceEventExt, TelemetryEventPropertyTypeExt, TelemetryEventCategory, ITelemetryPropertiesExt } from "./telemetryTypes";
|
|
8
|
+
export interface Memory {
|
|
9
|
+
usedJSHeapSize: number;
|
|
10
|
+
}
|
|
11
|
+
export interface PerformanceWithMemory extends IsomorphicPerformance {
|
|
12
|
+
readonly memory: Memory;
|
|
13
|
+
}
|
|
6
14
|
/**
|
|
7
15
|
* Broad classifications to be applied to individual properties as they're prepared to be logged to telemetry.
|
|
8
|
-
*
|
|
16
|
+
*
|
|
17
|
+
* @privateRemarks Please do not modify existing entries, to maintain backwards compatibility.
|
|
18
|
+
*
|
|
19
|
+
* @internal
|
|
9
20
|
*/
|
|
10
21
|
export declare enum TelemetryDataTag {
|
|
11
22
|
/**
|
|
12
|
-
* Data containing terms from code packages that may have been dynamically loaded
|
|
13
|
-
* @deprecated 1.0, will be removed in next release (see issue #6603). Use `TelemetryDataTag.CodeArtifact` instead.
|
|
23
|
+
* Data containing terms or IDs from code packages that may have been dynamically loaded
|
|
14
24
|
*/
|
|
15
|
-
PackageData = "PackageData",
|
|
16
|
-
/** Data containing terms or IDs from code packages that may have been dynamically loaded */
|
|
17
25
|
CodeArtifact = "CodeArtifact",
|
|
18
|
-
/**
|
|
26
|
+
/**
|
|
27
|
+
* Personal data of a variety of classifications that pertains to the user
|
|
28
|
+
*/
|
|
19
29
|
UserData = "UserData"
|
|
20
30
|
}
|
|
21
|
-
|
|
31
|
+
/**
|
|
32
|
+
* @alpha
|
|
33
|
+
*/
|
|
34
|
+
export type TelemetryEventPropertyTypes = ITelemetryBaseProperties[string];
|
|
35
|
+
/**
|
|
36
|
+
* @alpha
|
|
37
|
+
*/
|
|
22
38
|
export interface ITelemetryLoggerPropertyBag {
|
|
23
39
|
[index: string]: TelemetryEventPropertyTypes | (() => TelemetryEventPropertyTypes);
|
|
24
40
|
}
|
|
41
|
+
/**
|
|
42
|
+
* @alpha
|
|
43
|
+
*/
|
|
25
44
|
export interface ITelemetryLoggerPropertyBags {
|
|
26
45
|
all?: ITelemetryLoggerPropertyBag;
|
|
27
46
|
error?: ITelemetryLoggerPropertyBag;
|
|
28
47
|
}
|
|
48
|
+
/**
|
|
49
|
+
* Attempts to parse number from string.
|
|
50
|
+
* If it fails, it will return the original string.
|
|
51
|
+
*
|
|
52
|
+
* @remarks
|
|
53
|
+
* Used to make telemetry data typed (and support math operations, like comparison),
|
|
54
|
+
* in places where we do expect numbers (like contentsize/duration property in http header).
|
|
55
|
+
*
|
|
56
|
+
* @internal
|
|
57
|
+
*/
|
|
58
|
+
export declare function numberFromString(str: string | null | undefined): string | number | undefined;
|
|
59
|
+
/**
|
|
60
|
+
* @internal
|
|
61
|
+
*/
|
|
62
|
+
export declare function formatTick(tick: number): number;
|
|
63
|
+
/**
|
|
64
|
+
* String used to concatenate the namespace of parent loggers and their child loggers.
|
|
65
|
+
* @internal
|
|
66
|
+
*/
|
|
67
|
+
export declare const eventNamespaceSeparator: ":";
|
|
29
68
|
/**
|
|
30
69
|
* TelemetryLogger class contains various helper telemetry methods,
|
|
31
70
|
* encoding in one place schemas for various types of Fluid telemetry events.
|
|
32
71
|
* Creates sub-logger that appends properties to all events
|
|
33
72
|
*/
|
|
34
|
-
export declare abstract class TelemetryLogger implements
|
|
73
|
+
export declare abstract class TelemetryLogger implements ITelemetryLoggerExt {
|
|
35
74
|
protected readonly namespace?: string | undefined;
|
|
36
75
|
protected readonly properties?: ITelemetryLoggerPropertyBags | undefined;
|
|
37
|
-
static readonly eventNamespaceSeparator = ":";
|
|
38
|
-
static formatTick(tick: number): number;
|
|
39
76
|
/**
|
|
40
|
-
*
|
|
41
|
-
* If fails,returns original string.
|
|
42
|
-
* Used to make telemetry data typed (and support math operations, like comparison),
|
|
43
|
-
* in places where we do expect numbers (like contentsize/duration property in http header)
|
|
77
|
+
* {@inheritDoc eventNamespaceSeparator}
|
|
44
78
|
*/
|
|
45
|
-
static
|
|
79
|
+
static readonly eventNamespaceSeparator: ":";
|
|
46
80
|
static sanitizePkgName(name: string): string;
|
|
47
81
|
/**
|
|
48
82
|
* Take an unknown error object and add the appropriate info from it to the event. Message and stack will be copied
|
|
@@ -51,94 +85,153 @@ export declare abstract class TelemetryLogger implements ITelemetryLogger {
|
|
|
51
85
|
* @param error - Error to extract info from
|
|
52
86
|
* @param fetchStack - Whether to fetch the current callstack if error.stack is undefined
|
|
53
87
|
*/
|
|
54
|
-
static prepareErrorObject(event: ITelemetryBaseEvent, error:
|
|
88
|
+
static prepareErrorObject(event: ITelemetryBaseEvent, error: unknown, fetchStack: boolean): void;
|
|
55
89
|
constructor(namespace?: string | undefined, properties?: ITelemetryLoggerPropertyBags | undefined);
|
|
56
90
|
/**
|
|
57
91
|
* Send an event with the logger
|
|
58
92
|
*
|
|
59
93
|
* @param event - the event to send
|
|
60
94
|
*/
|
|
61
|
-
abstract send(event: ITelemetryBaseEvent): void;
|
|
95
|
+
abstract send(event: ITelemetryBaseEvent, logLevel?: LogLevel): void;
|
|
62
96
|
/**
|
|
63
97
|
* Send a telemetry event with the logger
|
|
64
98
|
*
|
|
65
99
|
* @param event - the event to send
|
|
66
100
|
* @param error - optional error object to log
|
|
101
|
+
* @param logLevel - optional level of the log. It category of event is set as error,
|
|
102
|
+
* then the logLevel will be upgraded to be an error.
|
|
67
103
|
*/
|
|
68
|
-
sendTelemetryEvent(event:
|
|
104
|
+
sendTelemetryEvent(event: ITelemetryGenericEventExt, error?: unknown, logLevel?: typeof LogLevel.verbose | typeof LogLevel.default): void;
|
|
69
105
|
/**
|
|
70
106
|
* Send a telemetry event with the logger
|
|
71
107
|
*
|
|
72
108
|
* @param event - the event to send
|
|
73
109
|
* @param error - optional error object to log
|
|
110
|
+
* @param logLevel - optional level of the log.
|
|
74
111
|
*/
|
|
75
|
-
protected sendTelemetryEventCore(event:
|
|
112
|
+
protected sendTelemetryEventCore(event: ITelemetryGenericEventExt & {
|
|
76
113
|
category: TelemetryEventCategory;
|
|
77
|
-
}, error?:
|
|
114
|
+
}, error?: unknown, logLevel?: LogLevel): void;
|
|
78
115
|
/**
|
|
79
116
|
* Send an error telemetry event with the logger
|
|
80
117
|
*
|
|
81
118
|
* @param event - the event to send
|
|
82
119
|
* @param error - optional error object to log
|
|
83
120
|
*/
|
|
84
|
-
sendErrorEvent(event: ITelemetryErrorEvent, error?:
|
|
121
|
+
sendErrorEvent(event: ITelemetryErrorEvent, error?: unknown): void;
|
|
85
122
|
/**
|
|
86
123
|
* Send a performance telemetry event with the logger
|
|
87
124
|
*
|
|
88
125
|
* @param event - Event to send
|
|
89
126
|
* @param error - optional error object to log
|
|
127
|
+
* @param logLevel - optional level of the log. It category of event is set as error,
|
|
128
|
+
* then the logLevel will be upgraded to be an error.
|
|
90
129
|
*/
|
|
91
|
-
sendPerformanceEvent(event:
|
|
130
|
+
sendPerformanceEvent(event: ITelemetryPerformanceEventExt, error?: unknown, logLevel?: typeof LogLevel.verbose | typeof LogLevel.default): void;
|
|
92
131
|
protected prepareEvent(event: ITelemetryBaseEvent): ITelemetryBaseEvent;
|
|
132
|
+
private extendProperties;
|
|
93
133
|
}
|
|
94
134
|
/**
|
|
95
135
|
* @deprecated 0.56, remove TaggedLoggerAdapter once its usage is removed from
|
|
96
136
|
* container-runtime. Issue: #8191
|
|
97
137
|
* TaggedLoggerAdapter class can add tag handling to your logger.
|
|
138
|
+
*
|
|
139
|
+
* @internal
|
|
98
140
|
*/
|
|
99
141
|
export declare class TaggedLoggerAdapter implements ITelemetryBaseLogger {
|
|
100
142
|
private readonly logger;
|
|
101
143
|
constructor(logger: ITelemetryBaseLogger);
|
|
144
|
+
/**
|
|
145
|
+
* {@inheritDoc @fluidframework/core-interfaces#ITelemetryBaseLogger.send}
|
|
146
|
+
*/
|
|
102
147
|
send(eventWithTagsMaybe: ITelemetryBaseEvent): void;
|
|
103
148
|
}
|
|
149
|
+
/**
|
|
150
|
+
* Create a child logger based on the provided props object.
|
|
151
|
+
*
|
|
152
|
+
* @remarks
|
|
153
|
+
* Passing in no props object (i.e. undefined) will return a logger that is effectively a no-op.
|
|
154
|
+
*
|
|
155
|
+
* @param props - logger is the base logger the child will log to after it's processing, namespace will be prefixed to all event names, properties are default properties that will be applied events.
|
|
156
|
+
*
|
|
157
|
+
* @alpha
|
|
158
|
+
*/
|
|
159
|
+
export declare function createChildLogger(props?: {
|
|
160
|
+
logger?: ITelemetryBaseLogger;
|
|
161
|
+
namespace?: string;
|
|
162
|
+
properties?: ITelemetryLoggerPropertyBags;
|
|
163
|
+
}): ITelemetryLoggerExt;
|
|
104
164
|
/**
|
|
105
165
|
* ChildLogger class contains various helper telemetry methods,
|
|
106
166
|
* encoding in one place schemas for various types of Fluid telemetry events.
|
|
107
|
-
* Creates sub-logger that appends properties to all events
|
|
167
|
+
* Creates sub-logger that appends properties to all events.
|
|
108
168
|
*/
|
|
109
169
|
export declare class ChildLogger extends TelemetryLogger {
|
|
110
170
|
protected readonly baseLogger: ITelemetryBaseLogger;
|
|
111
171
|
/**
|
|
112
172
|
* Create child logger
|
|
113
173
|
* @param baseLogger - Base logger to use to output events. If undefined, proper child logger
|
|
114
|
-
* is created, but it does not
|
|
174
|
+
* is created, but it does not send telemetry events anywhere.
|
|
115
175
|
* @param namespace - Telemetry event name prefix to add to all events
|
|
116
176
|
* @param properties - Base properties to add to all events
|
|
117
|
-
* @param propertyGetters - Getters to add additional properties to all events
|
|
118
177
|
*/
|
|
119
178
|
static create(baseLogger?: ITelemetryBaseLogger, namespace?: string, properties?: ITelemetryLoggerPropertyBags): TelemetryLogger;
|
|
120
179
|
private constructor();
|
|
180
|
+
get minLogLevel(): LogLevel | undefined;
|
|
181
|
+
private shouldFilterOutEvent;
|
|
121
182
|
/**
|
|
122
183
|
* Send an event with the logger
|
|
123
184
|
*
|
|
124
185
|
* @param event - the event to send
|
|
125
186
|
*/
|
|
126
|
-
send(event: ITelemetryBaseEvent): void;
|
|
187
|
+
send(event: ITelemetryBaseEvent, logLevel?: LogLevel): void;
|
|
127
188
|
}
|
|
189
|
+
/**
|
|
190
|
+
* Input properties for {@link createMultiSinkLogger}.
|
|
191
|
+
*
|
|
192
|
+
* @internal
|
|
193
|
+
*/
|
|
194
|
+
export interface MultiSinkLoggerProperties {
|
|
195
|
+
/**
|
|
196
|
+
* Will be prefixed to all event names.
|
|
197
|
+
*/
|
|
198
|
+
namespace?: string;
|
|
199
|
+
/**
|
|
200
|
+
* Default properties that will be applied to all events flowing through this logger.
|
|
201
|
+
*/
|
|
202
|
+
properties?: ITelemetryLoggerPropertyBags;
|
|
203
|
+
/**
|
|
204
|
+
* The base loggers that this logger will forward the logs to, after it processes them.
|
|
205
|
+
*/
|
|
206
|
+
loggers?: (ITelemetryBaseLogger | undefined)[];
|
|
207
|
+
/**
|
|
208
|
+
* If true, the logger will attempt to copy the custom properties (if they are of a known type, i.e. one from this package) of all the base loggers passed to it, to apply them itself to logs that flow through.
|
|
209
|
+
*/
|
|
210
|
+
tryInheritProperties?: true;
|
|
211
|
+
}
|
|
212
|
+
/**
|
|
213
|
+
* Create a logger which logs to multiple other loggers based on the provided props object.
|
|
214
|
+
*
|
|
215
|
+
* @internal
|
|
216
|
+
*/
|
|
217
|
+
export declare function createMultiSinkLogger(props: MultiSinkLoggerProperties): ITelemetryLoggerExt;
|
|
128
218
|
/**
|
|
129
219
|
* Multi-sink logger
|
|
130
220
|
* Takes multiple ITelemetryBaseLogger objects (sinks) and logs all events into each sink
|
|
131
|
-
* Implements ITelemetryBaseLogger (through static create() method)
|
|
132
221
|
*/
|
|
133
222
|
export declare class MultiSinkLogger extends TelemetryLogger {
|
|
134
223
|
protected loggers: ITelemetryBaseLogger[];
|
|
224
|
+
private _minLogLevelOfAllLoggers;
|
|
135
225
|
/**
|
|
136
226
|
* Create multiple sink logger (i.e. logger that sends events to multiple sinks)
|
|
137
227
|
* @param namespace - Telemetry event name prefix to add to all events
|
|
138
228
|
* @param properties - Base properties to add to all events
|
|
139
|
-
* @param
|
|
229
|
+
* @param loggers - The list of loggers to use as sinks
|
|
230
|
+
* @param tryInheritProperties - Will attempted to copy those loggers properties to this loggers if they are of a known type e.g. one from this package
|
|
140
231
|
*/
|
|
141
|
-
constructor(namespace?: string, properties?: ITelemetryLoggerPropertyBags);
|
|
232
|
+
constructor(namespace?: string, properties?: ITelemetryLoggerPropertyBags, loggers?: ITelemetryBaseLogger[], tryInheritProperties?: true);
|
|
233
|
+
get minLogLevel(): LogLevel;
|
|
234
|
+
private calculateMinLogLevel;
|
|
142
235
|
/**
|
|
143
236
|
* Add logger to send all events to
|
|
144
237
|
* @param logger - Logger to add
|
|
@@ -152,10 +245,15 @@ export declare class MultiSinkLogger extends TelemetryLogger {
|
|
|
152
245
|
send(event: ITelemetryBaseEvent): void;
|
|
153
246
|
}
|
|
154
247
|
/**
|
|
155
|
-
* Describes what events PerformanceEvent should log
|
|
156
|
-
*
|
|
157
|
-
*
|
|
248
|
+
* Describes what events {@link PerformanceEvent} should log.
|
|
249
|
+
*
|
|
250
|
+
* @remarks
|
|
251
|
+
* By default, all events are logged, but the client can override this behavior.
|
|
252
|
+
*
|
|
253
|
+
* For example, there is rarely a need to record a start event, as we're really after
|
|
158
254
|
* success / failure tracking, including duration (on success).
|
|
255
|
+
*
|
|
256
|
+
* @internal
|
|
159
257
|
*/
|
|
160
258
|
export interface IPerformanceEventMarkers {
|
|
161
259
|
start?: true;
|
|
@@ -163,42 +261,160 @@ export interface IPerformanceEventMarkers {
|
|
|
163
261
|
cancel?: "generic" | "error";
|
|
164
262
|
}
|
|
165
263
|
/**
|
|
166
|
-
* Helper class to log performance events
|
|
264
|
+
* Helper class to log performance events.
|
|
265
|
+
*
|
|
266
|
+
* @internal
|
|
167
267
|
*/
|
|
168
268
|
export declare class PerformanceEvent {
|
|
169
269
|
private readonly logger;
|
|
170
270
|
private readonly markers;
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
271
|
+
private readonly recordHeapSize;
|
|
272
|
+
private readonly emitLogs;
|
|
273
|
+
/**
|
|
274
|
+
* Creates an instance of {@link PerformanceEvent} and starts measurements
|
|
275
|
+
* @param logger - the logger to be used for publishing events
|
|
276
|
+
* @param event - the logging event details which will be published with the performance measurements
|
|
277
|
+
* @param markers - See {@link IPerformanceEventMarkers}
|
|
278
|
+
* @param recordHeapSize - whether or not to also record memory performance
|
|
279
|
+
* @param emitLogs - should this instance emit logs. If set to false, logs will not be emitted to the logger,
|
|
280
|
+
* but measurements will still be performed and any specified markers will be generated.
|
|
281
|
+
* @returns An instance of {@link PerformanceEvent}
|
|
282
|
+
*/
|
|
283
|
+
static start(logger: ITelemetryLoggerExt, event: ITelemetryGenericEventExt, markers?: IPerformanceEventMarkers, recordHeapSize?: boolean, emitLogs?: boolean): PerformanceEvent;
|
|
284
|
+
/**
|
|
285
|
+
* Measure a synchronous task
|
|
286
|
+
* @param logger - the logger to be used for publishing events
|
|
287
|
+
* @param event - the logging event details which will be published with the performance measurements
|
|
288
|
+
* @param callback - the task to be executed and measured
|
|
289
|
+
* @param markers - See {@link IPerformanceEventMarkers}
|
|
290
|
+
* @param sampleThreshold - events with the same name and category will be sent to the logger
|
|
291
|
+
* only when we hit this many executions of the task. If unspecified, all events will be sent.
|
|
292
|
+
* @returns The results of the executed task
|
|
293
|
+
*
|
|
294
|
+
* @remarks Note that if the "same" event (category + eventName) would be emitted by different
|
|
295
|
+
* tasks (`callback`), `sampleThreshold` is still applied only based on the event's category + eventName,
|
|
296
|
+
* so executing either of the tasks will increase the internal counter and they
|
|
297
|
+
* effectively "share" the sampling rate for the event.
|
|
298
|
+
*/
|
|
299
|
+
static timedExec<T>(logger: ITelemetryLoggerExt, event: ITelemetryGenericEventExt, callback: (event: PerformanceEvent) => T, markers?: IPerformanceEventMarkers, sampleThreshold?: number): T;
|
|
300
|
+
/**
|
|
301
|
+
* Measure an asynchronous task
|
|
302
|
+
* @param logger - the logger to be used for publishing events
|
|
303
|
+
* @param event - the logging event details which will be published with the performance measurements
|
|
304
|
+
* @param callback - the task to be executed and measured
|
|
305
|
+
* @param markers - See {@link IPerformanceEventMarkers}
|
|
306
|
+
* @param recordHeapSize - whether or not to also record memory performance
|
|
307
|
+
* @param sampleThreshold - events with the same name and category will be sent to the logger
|
|
308
|
+
* only when we hit this many executions of the task. If unspecified, all events will be sent.
|
|
309
|
+
* @returns The results of the executed task
|
|
310
|
+
*
|
|
311
|
+
* @remarks Note that if the "same" event (category + eventName) would be emitted by different
|
|
312
|
+
* tasks (`callback`), `sampleThreshold` is still applied only based on the event's category + eventName,
|
|
313
|
+
* so executing either of the tasks will increase the internal counter and they
|
|
314
|
+
* effectively "share" the sampling rate for the event.
|
|
315
|
+
*/
|
|
316
|
+
static timedExecAsync<T>(logger: ITelemetryLoggerExt, event: ITelemetryGenericEventExt, callback: (event: PerformanceEvent) => Promise<T>, markers?: IPerformanceEventMarkers, recordHeapSize?: boolean, sampleThreshold?: number): Promise<T>;
|
|
174
317
|
get duration(): number;
|
|
175
318
|
private event?;
|
|
176
319
|
private readonly startTime;
|
|
177
320
|
private startMark?;
|
|
178
|
-
|
|
179
|
-
|
|
321
|
+
private startMemoryCollection;
|
|
322
|
+
protected constructor(logger: ITelemetryLoggerExt, event: ITelemetryGenericEventExt, markers?: IPerformanceEventMarkers, recordHeapSize?: boolean, emitLogs?: boolean);
|
|
323
|
+
reportProgress(props?: ITelemetryPropertiesExt, eventNameSuffix?: string): void;
|
|
180
324
|
private autoEnd;
|
|
181
|
-
end(props?:
|
|
325
|
+
end(props?: ITelemetryPropertiesExt): void;
|
|
182
326
|
private performanceEndMark;
|
|
183
|
-
cancel(props?:
|
|
327
|
+
cancel(props?: ITelemetryPropertiesExt, error?: unknown): void;
|
|
184
328
|
/**
|
|
185
329
|
* Report the event, if it hasn't already been reported.
|
|
186
330
|
*/
|
|
187
|
-
reportEvent(eventNameSuffix: string, props?:
|
|
331
|
+
reportEvent(eventNameSuffix: string, props?: ITelemetryPropertiesExt, error?: unknown): void;
|
|
332
|
+
private static readonly eventHits;
|
|
333
|
+
private static shouldReport;
|
|
188
334
|
}
|
|
189
335
|
/**
|
|
190
|
-
*
|
|
191
|
-
*
|
|
336
|
+
* Null logger that no-ops for all telemetry events passed to it.
|
|
337
|
+
*
|
|
338
|
+
* @deprecated This will be removed in a future release.
|
|
339
|
+
* For internal use within the FluidFramework codebase, use {@link createChildLogger} with no arguments instead.
|
|
340
|
+
* For external consumers we recommend writing a trivial implementation of {@link @fluidframework/core-interfaces#ITelemetryBaseLogger}
|
|
341
|
+
* where the send() method does nothing and using that.
|
|
342
|
+
*
|
|
343
|
+
* @internal
|
|
192
344
|
*/
|
|
193
|
-
export declare class
|
|
345
|
+
export declare class TelemetryNullLogger implements ITelemetryLoggerExt {
|
|
194
346
|
send(event: ITelemetryBaseEvent): void;
|
|
195
|
-
sendTelemetryEvent(event: ITelemetryGenericEvent, error?:
|
|
196
|
-
sendErrorEvent(event: ITelemetryErrorEvent, error?:
|
|
197
|
-
sendPerformanceEvent(event: ITelemetryPerformanceEvent, error?:
|
|
198
|
-
logGenericError(eventName: string, error: any): void;
|
|
199
|
-
logException(event: ITelemetryErrorEvent, exception: any): void;
|
|
200
|
-
debugAssert(condition: boolean, event?: ITelemetryErrorEvent): void;
|
|
201
|
-
shipAssert(condition: boolean, event?: ITelemetryErrorEvent): void;
|
|
202
|
-
private reportError;
|
|
347
|
+
sendTelemetryEvent(event: ITelemetryGenericEvent, error?: unknown): void;
|
|
348
|
+
sendErrorEvent(event: ITelemetryErrorEvent, error?: unknown): void;
|
|
349
|
+
sendPerformanceEvent(event: ITelemetryPerformanceEvent, error?: unknown): void;
|
|
203
350
|
}
|
|
351
|
+
/**
|
|
352
|
+
* Takes in value, and does one of 4 things.
|
|
353
|
+
* if value is of primitive type - returns the original value.
|
|
354
|
+
* If the value is a flat array or object - returns a stringified version of the array/object.
|
|
355
|
+
* If the value is an object of type Tagged<TelemetryEventPropertyType> - returns the object
|
|
356
|
+
* with its values recursively converted to base property Type.
|
|
357
|
+
* If none of these cases are reached - returns an error string
|
|
358
|
+
* @param x - value passed in to convert to a base property type
|
|
359
|
+
*/
|
|
360
|
+
export declare function convertToBasePropertyType(x: TelemetryEventPropertyTypeExt | Tagged<TelemetryEventPropertyTypeExt>): TelemetryEventPropertyType | Tagged<TelemetryEventPropertyType>;
|
|
361
|
+
/**
|
|
362
|
+
* Tags all given `values` with the same `tag`.
|
|
363
|
+
*
|
|
364
|
+
* @param tag - The tag with which all `values` will be annotated.
|
|
365
|
+
* @param values - The values to be tagged.
|
|
366
|
+
*
|
|
367
|
+
* @remarks
|
|
368
|
+
* It supports properties of type {@link @fluidframework/core-interfaces#TelemetryBaseEventPropertyType},
|
|
369
|
+
* as well as callbacks that return that type.
|
|
370
|
+
*
|
|
371
|
+
* @example Sample usage
|
|
372
|
+
* ```typescript
|
|
373
|
+
* {
|
|
374
|
+
* // ...Other properties being added to a telemetry event
|
|
375
|
+
* ...tagData("someTag", {foo: 1, bar: 2}),
|
|
376
|
+
* // ...
|
|
377
|
+
* }
|
|
378
|
+
* ```
|
|
379
|
+
* This will result in `foo` and `bar` added to the event with their values tagged.
|
|
380
|
+
*
|
|
381
|
+
* @internal
|
|
382
|
+
*/
|
|
383
|
+
export declare const tagData: <T extends TelemetryDataTag, V extends Record<string, import("@fluidframework/core-interfaces").TelemetryEventPropertyType | (() => TelemetryBaseEventPropertyType)>>(tag: T, values: V) => { [P in keyof V]: (V[P] extends () => TelemetryBaseEventPropertyType ? () => {
|
|
384
|
+
value: ReturnType<V[P]>;
|
|
385
|
+
tag: T;
|
|
386
|
+
} : {
|
|
387
|
+
value: Exclude<V[P], undefined>;
|
|
388
|
+
tag: T;
|
|
389
|
+
}) | (V[P] extends undefined ? undefined : never); };
|
|
390
|
+
/**
|
|
391
|
+
* Tags all provided `values` as {@link TelemetryDataTag.CodeArtifact}.
|
|
392
|
+
*
|
|
393
|
+
* @param values - The values to be tagged.
|
|
394
|
+
*
|
|
395
|
+
* @remarks
|
|
396
|
+
* It supports properties of type {@link @fluidframework/core-interfaces#TelemetryBaseEventPropertyType},
|
|
397
|
+
* as well as callbacks that return that type.
|
|
398
|
+
*
|
|
399
|
+
* @example Sample usage
|
|
400
|
+
* ```typescript
|
|
401
|
+
* {
|
|
402
|
+
* // ...Other properties being added to a telemetry event
|
|
403
|
+
* ...tagCodeArtifacts("someTag", {foo: 1, bar: 2}),
|
|
404
|
+
* // ...
|
|
405
|
+
* }
|
|
406
|
+
* ```
|
|
407
|
+
* This will result in `foo` and `bar` added to the event with their values tagged as {@link TelemetryDataTag.CodeArtifact}.
|
|
408
|
+
*
|
|
409
|
+
* @see {@link tagData}
|
|
410
|
+
*
|
|
411
|
+
* @internal
|
|
412
|
+
*/
|
|
413
|
+
export declare const tagCodeArtifacts: <T extends Record<string, import("@fluidframework/core-interfaces").TelemetryEventPropertyType | (() => TelemetryBaseEventPropertyType)>>(values: T) => { [P in keyof T]: (T[P] extends () => TelemetryBaseEventPropertyType ? () => {
|
|
414
|
+
value: ReturnType<T[P]>;
|
|
415
|
+
tag: TelemetryDataTag.CodeArtifact;
|
|
416
|
+
} : {
|
|
417
|
+
value: Exclude<T[P], undefined>;
|
|
418
|
+
tag: TelemetryDataTag.CodeArtifact;
|
|
419
|
+
}) | (T[P] extends undefined ? undefined : never); };
|
|
204
420
|
//# sourceMappingURL=logger.d.ts.map
|
package/dist/logger.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../src/logger.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,
|
|
1
|
+
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../src/logger.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,mBAAmB,EACnB,oBAAoB,EACpB,oBAAoB,EACpB,sBAAsB,EACtB,0BAA0B,EAC1B,8BAA8B,IAAI,0BAA0B,EAC5D,QAAQ,EACR,MAAM,EACN,wBAAwB,EACxB,8BAA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