@microsoft/sp-diagnostics 1.22.0-beta.2 → 1.22.0-beta.4

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.
Files changed (138) hide show
  1. package/dist/78359e4b-07c2-43c6-8d0b-d060b4d577e8.manifest.json +3 -3
  2. package/dist/{sp-diagnostics_none_a5c0c2a17bce8b457f0d.js → sp-diagnostics_none_f723633aa801623e45a1.js} +1 -1
  3. package/lib/Api/Engagement/EngagementLogger.d.ts +75 -0
  4. package/lib/Api/Engagement/EngagementLogger.d.ts.map +1 -0
  5. package/lib/Api/Engagement/EngagementLogger.js +143 -0
  6. package/lib/Api/Engagement/IEngagementHandler.d.ts +87 -0
  7. package/lib/Api/Engagement/IEngagementHandler.d.ts.map +1 -0
  8. package/lib/Api/Engagement/IEngagementHandler.js +2 -0
  9. package/lib/Api/ExecutionQueue.d.ts +55 -0
  10. package/lib/Api/ExecutionQueue.d.ts.map +1 -0
  11. package/lib/Api/ExecutionQueue.js +133 -0
  12. package/lib/Api/ILogData.d.ts +36 -0
  13. package/lib/Api/ILogData.d.ts.map +1 -0
  14. package/lib/Api/ILogData.js +3 -0
  15. package/lib/Api/ILogEntry.d.ts +29 -0
  16. package/lib/Api/ILogEntry.d.ts.map +1 -0
  17. package/lib/Api/ILogEntry.js +2 -0
  18. package/lib/Api/ILogErrorData.d.ts +21 -0
  19. package/lib/Api/ILogErrorData.d.ts.map +1 -0
  20. package/lib/Api/ILogErrorData.js +3 -0
  21. package/lib/Api/ILogSource.d.ts +10 -0
  22. package/lib/Api/ILogSource.d.ts.map +1 -0
  23. package/lib/Api/ILogSource.js +3 -0
  24. package/lib/Api/ILogVerboseData.d.ts +12 -0
  25. package/lib/Api/ILogVerboseData.d.ts.map +1 -0
  26. package/lib/Api/ILogVerboseData.js +3 -0
  27. package/lib/Api/Log/LogHandler.d.ts +12 -0
  28. package/lib/Api/Log/LogHandler.d.ts.map +1 -0
  29. package/lib/Api/Log/LogHandler.js +41 -0
  30. package/lib/Api/LogEntry.d.ts +29 -0
  31. package/lib/Api/LogEntry.d.ts.map +1 -0
  32. package/lib/Api/LogEntry.js +51 -0
  33. package/lib/Api/LogFeature.d.ts +7 -0
  34. package/lib/Api/LogFeature.d.ts.map +1 -0
  35. package/lib/Api/LogFeature.js +11 -0
  36. package/lib/Api/LogLevel.d.ts +23 -0
  37. package/lib/Api/LogLevel.d.ts.map +1 -0
  38. package/lib/Api/LogLevel.js +24 -0
  39. package/lib/Api/LogManager/CircularBuffer.d.ts +36 -0
  40. package/lib/Api/LogManager/CircularBuffer.d.ts.map +1 -0
  41. package/lib/Api/LogManager/CircularBuffer.js +98 -0
  42. package/lib/Api/LogManager/LogManager.d.ts +47 -0
  43. package/lib/Api/LogManager/LogManager.d.ts.map +1 -0
  44. package/lib/Api/LogManager/LogManager.js +121 -0
  45. package/lib/Api/LogSource.d.ts +24 -0
  46. package/lib/Api/LogSource.d.ts.map +1 -0
  47. package/lib/Api/LogSource.js +40 -0
  48. package/lib/Api/LogType.d.ts +21 -0
  49. package/lib/Api/LogType.d.ts.map +1 -0
  50. package/lib/Api/LogType.js +23 -0
  51. package/lib/Api/Qos/AutoAlertableQosMonitor.d.ts +72 -0
  52. package/lib/Api/Qos/AutoAlertableQosMonitor.d.ts.map +1 -0
  53. package/lib/Api/Qos/AutoAlertableQosMonitor.js +93 -0
  54. package/lib/Api/Qos/CustomerPromiseInterfaces/ICustomerPromiseErrorDetails.d.ts +39 -0
  55. package/lib/Api/Qos/CustomerPromiseInterfaces/ICustomerPromiseErrorDetails.d.ts.map +1 -0
  56. package/lib/Api/Qos/CustomerPromiseInterfaces/ICustomerPromiseErrorDetails.js +2 -0
  57. package/lib/Api/Qos/CustomerPromiseInterfaces/IExtraDataForCustomerPromise.d.ts +12 -0
  58. package/lib/Api/Qos/CustomerPromiseInterfaces/IExtraDataForCustomerPromise.d.ts.map +1 -0
  59. package/lib/Api/Qos/CustomerPromiseInterfaces/IExtraDataForCustomerPromise.js +2 -0
  60. package/lib/Api/Qos/IQos.d.ts +17 -0
  61. package/lib/Api/Qos/IQos.d.ts.map +1 -0
  62. package/lib/Api/Qos/IQos.js +2 -0
  63. package/lib/Api/Qos/IQosEndEvent.d.ts +13 -0
  64. package/lib/Api/Qos/IQosEndEvent.d.ts.map +1 -0
  65. package/lib/Api/Qos/IQosEndEvent.js +2 -0
  66. package/lib/Api/Qos/IQosExtraData.d.ts +50 -0
  67. package/lib/Api/Qos/IQosExtraData.d.ts.map +1 -0
  68. package/lib/Api/Qos/IQosExtraData.js +2 -0
  69. package/lib/Api/Qos/IQosStartEvent.d.ts +8 -0
  70. package/lib/Api/Qos/IQosStartEvent.d.ts.map +1 -0
  71. package/lib/Api/Qos/IQosStartEvent.js +2 -0
  72. package/lib/Api/Qos/QosLogger.d.ts +27 -0
  73. package/lib/Api/Qos/QosLogger.d.ts.map +1 -0
  74. package/lib/Api/Qos/QosLogger.js +74 -0
  75. package/lib/Api/Qos/QosMonitor.d.ts +74 -0
  76. package/lib/Api/Qos/QosMonitor.d.ts.map +1 -0
  77. package/lib/Api/Qos/QosMonitor.js +304 -0
  78. package/lib/Api/Qos/QosMonitorShareFailureWithCP.d.ts +50 -0
  79. package/lib/Api/Qos/QosMonitorShareFailureWithCP.d.ts.map +1 -0
  80. package/lib/Api/Qos/QosMonitorShareFailureWithCP.js +114 -0
  81. package/lib/Api/Qos/QosResultType.d.ts +15 -0
  82. package/lib/Api/Qos/QosResultType.d.ts.map +1 -0
  83. package/lib/Api/Qos/QosResultType.js +11 -0
  84. package/lib/Api/Trace/DefaultTraceHandler.d.ts +15 -0
  85. package/lib/Api/Trace/DefaultTraceHandler.d.ts.map +1 -0
  86. package/lib/Api/Trace/DefaultTraceHandler.js +30 -0
  87. package/lib/Api/Trace/ITraceHandler.d.ts +29 -0
  88. package/lib/Api/Trace/ITraceHandler.d.ts.map +1 -0
  89. package/lib/Api/Trace/ITraceHandler.js +2 -0
  90. package/lib/Api/Trace/ITraceLogger.d.ts +13 -0
  91. package/lib/Api/Trace/ITraceLogger.d.ts.map +1 -0
  92. package/lib/Api/Trace/ITraceLogger.js +2 -0
  93. package/lib/Api/Trace/LogEvent.d.ts +49 -0
  94. package/lib/Api/Trace/LogEvent.d.ts.map +1 -0
  95. package/lib/Api/Trace/LogEvent.js +147 -0
  96. package/lib/Api/Trace/TraceLogger.d.ts +102 -0
  97. package/lib/Api/Trace/TraceLogger.d.ts.map +1 -0
  98. package/lib/Api/Trace/TraceLogger.js +197 -0
  99. package/lib/Diagnostics.d.ts +47 -0
  100. package/lib/Diagnostics.d.ts.map +1 -0
  101. package/lib/Diagnostics.js +82 -0
  102. package/lib/DiagnosticsSettingsManager.d.ts +19 -0
  103. package/lib/DiagnosticsSettingsManager.d.ts.map +1 -0
  104. package/lib/DiagnosticsSettingsManager.js +62 -0
  105. package/lib/IDiagnosticsSettings.d.ts +87 -0
  106. package/lib/IDiagnosticsSettings.d.ts.map +1 -0
  107. package/lib/IDiagnosticsSettings.js +2 -0
  108. package/lib/common/Killswitches.d.ts +3 -0
  109. package/lib/common/Killswitches.d.ts.map +1 -0
  110. package/lib/common/Killswitches.js +14 -0
  111. package/lib/extraData/DisplayApp.d.ts +6 -0
  112. package/lib/extraData/DisplayApp.d.ts.map +1 -0
  113. package/lib/extraData/DisplayApp.js +6 -0
  114. package/lib/extraData/IDiagnosticContextInfo.d.ts +18 -0
  115. package/lib/extraData/IDiagnosticContextInfo.d.ts.map +1 -0
  116. package/lib/extraData/IDiagnosticContextInfo.js +2 -0
  117. package/lib/extraData/IPageExtraData.d.ts +16 -0
  118. package/lib/extraData/IPageExtraData.d.ts.map +1 -0
  119. package/lib/extraData/IPageExtraData.js +2 -0
  120. package/lib/extraData/PageType.d.ts +13 -0
  121. package/lib/extraData/PageType.d.ts.map +1 -0
  122. package/lib/extraData/PageType.js +16 -0
  123. package/lib/extraData/PromotedState.d.ts +16 -0
  124. package/lib/extraData/PromotedState.d.ts.map +1 -0
  125. package/lib/extraData/PromotedState.js +17 -0
  126. package/lib/extraData/WebTemplateId.d.ts +8 -0
  127. package/lib/extraData/WebTemplateId.d.ts.map +1 -0
  128. package/lib/extraData/WebTemplateId.js +10 -0
  129. package/lib/extraData/setPageExtraData.d.ts +5 -0
  130. package/lib/extraData/setPageExtraData.d.ts.map +1 -0
  131. package/lib/extraData/setPageExtraData.js +66 -0
  132. package/lib/index.d.ts +42 -0
  133. package/lib/index.d.ts.map +1 -0
  134. package/lib/index.js +27 -0
  135. package/lib/sp-diagnostics.manifest.json +8 -0
  136. package/lib-commonjs/common/Killswitches.js +8 -1
  137. package/lib-commonjs/extraData/setPageExtraData.js +4 -0
  138. package/package.json +6 -6
@@ -0,0 +1,133 @@
1
+ /**
2
+ * ExecutionQueue allows multiple handlers to be processed in real time or deferred.
3
+ * @internal
4
+ */
5
+ var ExecutionQueue = /** @class */ (function () {
6
+ function ExecutionQueue() {
7
+ this._shouldExecuteInRealTime = false;
8
+ this._handlers = {};
9
+ this._executionEntries = [];
10
+ }
11
+ Object.defineProperty(ExecutionQueue.prototype, "shouldExecuteInRealTime", {
12
+ /**
13
+ * Determines if the added execution entries should be processed in real time.
14
+ * If this is set to true, a stack with entries will not be saved.
15
+ */
16
+ get: function () {
17
+ return this._shouldExecuteInRealTime;
18
+ },
19
+ /**
20
+ * Sets the behavior for this execution stack.
21
+ * When set to true, all entries on stack will be processed and future entries
22
+ * will be executed in real time.
23
+ * When set to false, future entries will be saved in the execution stack for
24
+ * later processing.
25
+ */
26
+ set: function (executeInRealTime) {
27
+ this._shouldExecuteInRealTime = executeInRealTime;
28
+ if (this._shouldExecuteInRealTime) {
29
+ this.flush();
30
+ }
31
+ },
32
+ enumerable: false,
33
+ configurable: true
34
+ });
35
+ /**
36
+ * Registers an external handler to collection for delayed asynchronous processing.
37
+ * Handlers are registered once. If handler is already registered, it does nothing.
38
+ */
39
+ ExecutionQueue.prototype.addHandler = function (key, handler) {
40
+ if (this._containsHandler(key, handler)) {
41
+ return;
42
+ }
43
+ this._initializeHandlerArrayForKey(key);
44
+ var handlers = this._handlers[key];
45
+ if (handlers.indexOf(handler) === -1) {
46
+ handlers.push(handler);
47
+ }
48
+ };
49
+ /**
50
+ * Execution Entry registration for delayed asynchronous processing.
51
+ */
52
+ ExecutionQueue.prototype.addExecutionEntry = function (key) {
53
+ var args = [];
54
+ for (var _i = 1; _i < arguments.length; _i++) {
55
+ args[_i - 1] = arguments[_i];
56
+ }
57
+ Object.freeze(args);
58
+ if (this._shouldExecuteInRealTime) {
59
+ this._processExecutionEntry(key, args);
60
+ }
61
+ else {
62
+ this._executionEntries.push({ key: key, args: args });
63
+ }
64
+ };
65
+ /**
66
+ * Removes an external executionEntry handler from collection for asynchronous event logging.
67
+ * Logger is registered once.
68
+ */
69
+ ExecutionQueue.prototype.removeHandler = function (key, handler) {
70
+ var index = this._handlers[key].indexOf(handler);
71
+ if (index > -1) {
72
+ this._handlers[key].splice(index, 1);
73
+ }
74
+ };
75
+ /**
76
+ * Reset function clears executionEntry handler collection for asynchronous event logging.
77
+ * All recorded execution entries and handlers are purged.
78
+ */
79
+ ExecutionQueue.prototype.reset = function () {
80
+ this._handlers = {};
81
+ this._executionEntries = [];
82
+ };
83
+ /**
84
+ * Flushes all the buffered execution entries.
85
+ * All recorded execution entries are purged.
86
+ */
87
+ ExecutionQueue.prototype.flush = function () {
88
+ this._processAllExecutionEntries();
89
+ this._executionEntries = [];
90
+ };
91
+ ExecutionQueue.prototype._containsHandler = function (key, handler) {
92
+ if (this._handlers[key] !== null && this._handlers[key] !== undefined) {
93
+ return this._handlers[key].indexOf(handler) > -1;
94
+ }
95
+ return false;
96
+ };
97
+ ExecutionQueue.prototype._initializeHandlerArrayForKey = function (key) {
98
+ if (this._handlers[key] === null || this._handlers[key] === undefined) {
99
+ this._handlers[key] = [];
100
+ }
101
+ };
102
+ ExecutionQueue.prototype._processAllExecutionEntries = function () {
103
+ for (var _i = 0, _a = this._executionEntries; _i < _a.length; _i++) {
104
+ var entry = _a[_i];
105
+ if (entry && this._handlers[entry.key]) {
106
+ try {
107
+ for (var _b = 0, _c = this._handlers[entry.key]; _b < _c.length; _b++) {
108
+ var handler = _c[_b];
109
+ handler.apply(this, entry.args);
110
+ }
111
+ }
112
+ catch (e) {
113
+ // eslint-disable-next-line no-console
114
+ console.error('failed to process execution entry:' + e.toString());
115
+ }
116
+ }
117
+ }
118
+ };
119
+ ExecutionQueue.prototype._processExecutionEntry = function (key, args) {
120
+ for (var i = 0; i < this._handlers[key].length; i++) {
121
+ try {
122
+ this._handlers[key][i].apply(this, args);
123
+ }
124
+ catch (e) {
125
+ // eslint-disable-next-line no-console
126
+ console.error('failed to process execution entry:' + e.toString());
127
+ }
128
+ }
129
+ };
130
+ return ExecutionQueue;
131
+ }());
132
+ export default ExecutionQueue;
133
+ //# sourceMappingURL=ExecutionQueue.js.map
@@ -0,0 +1,36 @@
1
+ import type ILogEntry from './ILogEntry';
2
+ import type ILogSource from './ILogSource';
3
+ import type { ServiceScope } from '@microsoft/sp-core-library';
4
+ /**
5
+ * If you don't specify parameter:eventName
6
+ * the event name for all errors logged that way will be same "CaughtError" with
7
+ * appropriate prefix ("ModernPublish.CaughtError" etc.)
8
+ * The parameter "eventName" is there to be used from Qos.
9
+ * It is not encouraged to use it directly from ErrorHelper but if you do,
10
+ * the log will be written with custom event name of following format:
11
+ * <Workload>.<eventName>.<resultCode>.Failure, where resultCOde is only used
12
+ * in ILogErrorData.
13
+ *
14
+ *
15
+ * @internal
16
+ */
17
+ interface ILogData {
18
+ /**
19
+ *
20
+ */
21
+ source: ILogSource;
22
+ /**
23
+ *
24
+ */
25
+ eventName?: string;
26
+ /**
27
+ *
28
+ */
29
+ serviceScope?: ServiceScope;
30
+ /**
31
+ *
32
+ */
33
+ logEntry?: ILogEntry;
34
+ }
35
+ export default ILogData;
36
+ //# sourceMappingURL=ILogData.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ILogData.d.ts","sourceRoot":"","sources":["../../src/Api/ILogData.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,SAAS,MAAM,aAAa,CAAC;AACzC,OAAO,KAAK,UAAU,MAAM,cAAc,CAAC;AAC3C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAE/D;;;;;;;;;;;;GAYG;AACH,UAAU,QAAQ;IAChB;;OAEG;IACH,MAAM,EAAE,UAAU,CAAC;IAEnB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB;;OAEG;IACH,YAAY,CAAC,EAAE,YAAY,CAAC;IAE5B;;OAEG;IACH,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB;AAED,eAAe,QAAQ,CAAC"}
@@ -0,0 +1,3 @@
1
+ // Copyright (c) Microsoft. All rights reserved.
2
+ export {};
3
+ //# sourceMappingURL=ILogData.js.map
@@ -0,0 +1,29 @@
1
+ import type LogType from './LogType';
2
+ /**
3
+ * @internal
4
+ */
5
+ interface ILogEntry {
6
+ /**
7
+ * Optionally log if the event indicates an intentional action or not
8
+ */
9
+ isIntentional?: boolean;
10
+ /**
11
+ * The name of the module associated with this entry
12
+ */
13
+ moduleName: string;
14
+ /**
15
+ * The feature associated with this entry
16
+ */
17
+ logFeature: string;
18
+ /**
19
+ * The log type
20
+ * todo: dkholo:task#356773 perform a cleanup after data format validation confirmation
21
+ */
22
+ logType: LogType;
23
+ /**
24
+ * The optional property bag
25
+ */
26
+ logProperties?: Record<string, string | undefined>;
27
+ }
28
+ export default ILogEntry;
29
+ //# sourceMappingURL=ILogEntry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ILogEntry.d.ts","sourceRoot":"","sources":["../../src/Api/ILogEntry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,OAAO,MAAM,WAAW,CAAC;AAErC;;GAEG;AACH,UAAU,SAAS;IACjB;;OAEG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB;;OAEG;IACH,UAAU,EAAE,MAAM,CAAC;IAEnB;;OAEG;IACH,UAAU,EAAE,MAAM,CAAC;IAEnB;;;OAGG;IACH,OAAO,EAAE,OAAO,CAAC;IAEjB;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC;CACpD;AAED,eAAe,SAAS,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=ILogEntry.js.map
@@ -0,0 +1,21 @@
1
+ import type ILogData from './ILogData';
2
+ /**
3
+ * The error parameter is the only required parameter and basically will be just converted to string and
4
+ * logged to Debug stream (RealibilityLogs in SLAPI).
5
+ * It will also be uploaded to the server immediately and not wait for next batch log upload.
6
+ * The parameter "resultCode" is there to be used from Qos.
7
+ *
8
+ * @internal
9
+ */
10
+ interface ILogErrorData extends ILogData {
11
+ /**
12
+ * The error associated with this log data.
13
+ */
14
+ error: Error;
15
+ /**
16
+ *
17
+ */
18
+ resultCode?: string;
19
+ }
20
+ export default ILogErrorData;
21
+ //# sourceMappingURL=ILogErrorData.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ILogErrorData.d.ts","sourceRoot":"","sources":["../../src/Api/ILogErrorData.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,QAAQ,MAAM,YAAY,CAAC;AAEvC;;;;;;;GAOG;AACH,UAAU,aAAc,SAAQ,QAAQ;IACtC;;OAEG;IACH,KAAK,EAAE,KAAK,CAAC;IAEb;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,eAAe,aAAa,CAAC"}
@@ -0,0 +1,3 @@
1
+ // Copyright (c) Microsoft. All rights reserved.
2
+ export {};
3
+ //# sourceMappingURL=ILogErrorData.js.map
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Interface defining the source a log
3
+ *
4
+ * @internal
5
+ */
6
+ interface ILogSource {
7
+ id: string;
8
+ }
9
+ export default ILogSource;
10
+ //# sourceMappingURL=ILogSource.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ILogSource.d.ts","sourceRoot":"","sources":["../../src/Api/ILogSource.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,UAAU,UAAU;IAIlB,EAAE,EAAE,MAAM,CAAC;CACZ;AAED,eAAe,UAAU,CAAC"}
@@ -0,0 +1,3 @@
1
+ // Copyright (c) Microsoft. All rights reserved.
2
+ export {};
3
+ //# sourceMappingURL=ILogSource.js.map
@@ -0,0 +1,12 @@
1
+ import type ILogData from './ILogData';
2
+ /**
3
+ * @internal
4
+ */
5
+ interface ILogVerboseData extends ILogData {
6
+ /**
7
+ * The message associated with this log data.
8
+ */
9
+ message: string;
10
+ }
11
+ export default ILogVerboseData;
12
+ //# sourceMappingURL=ILogVerboseData.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ILogVerboseData.d.ts","sourceRoot":"","sources":["../../src/Api/ILogVerboseData.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,QAAQ,MAAM,YAAY,CAAC;AAEvC;;GAEG;AACH,UAAU,eAAgB,SAAQ,QAAQ;IACxC;;OAEG;IACH,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,eAAe,eAAe,CAAC"}
@@ -0,0 +1,3 @@
1
+ // Copyright (c) Microsoft. All rights reserved.
2
+ export {};
3
+ //# sourceMappingURL=ILogVerboseData.js.map
@@ -0,0 +1,12 @@
1
+ import type { ILogHandler, ServiceScope } from '@microsoft/sp-core-library';
2
+ /**
3
+ * This handler adapts the sp-core-library Log to use the internal telemetry.
4
+ * @internal
5
+ */
6
+ export default class LogHandler implements ILogHandler {
7
+ verbose(source: string, message: string, scope: ServiceScope): void;
8
+ info(source: string, message: string, scope: ServiceScope): void;
9
+ warn(source: string, message: string, scope: ServiceScope): void;
10
+ error(source: string, error: Error, scope: ServiceScope): void;
11
+ }
12
+ //# sourceMappingURL=LogHandler.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LogHandler.d.ts","sourceRoot":"","sources":["../../../src/Api/Log/LogHandler.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAI5E;;;GAGG;AACH,MAAM,CAAC,OAAO,OAAO,UAAW,YAAW,WAAW;IAC7C,OAAO,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,YAAY,GAAG,IAAI;IAQnE,IAAI,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,YAAY,GAAG,IAAI;IAQhE,IAAI,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,YAAY,GAAG,IAAI;IAQhE,KAAK,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,YAAY,GAAG,IAAI;CAOtE"}
@@ -0,0 +1,41 @@
1
+ import { LogLevel } from '../LogLevel';
2
+ import LogEvent from '../Trace/LogEvent';
3
+ /**
4
+ * This handler adapts the sp-core-library Log to use the internal telemetry.
5
+ * @internal
6
+ */
7
+ var LogHandler = /** @class */ (function () {
8
+ function LogHandler() {
9
+ }
10
+ LogHandler.prototype.verbose = function (source, message, scope) {
11
+ var event = LogEvent.log(source, message, LogLevel.Verbose, scope);
12
+ if (DEBUG && !DEPRECATED_UNIT_TEST) {
13
+ // eslint-disable-next-line no-console
14
+ console.log(event.toString());
15
+ }
16
+ };
17
+ LogHandler.prototype.info = function (source, message, scope) {
18
+ var event = LogEvent.log(source, message, LogLevel.Info, scope);
19
+ if (DEBUG && !DEPRECATED_UNIT_TEST) {
20
+ // eslint-disable-next-line no-console
21
+ console.info(event.toString());
22
+ }
23
+ };
24
+ LogHandler.prototype.warn = function (source, message, scope) {
25
+ var event = LogEvent.log(source, message, LogLevel.Warning, scope);
26
+ if (DEBUG && !DEPRECATED_UNIT_TEST) {
27
+ // eslint-disable-next-line no-console
28
+ console.warn(event.toString());
29
+ }
30
+ };
31
+ LogHandler.prototype.error = function (source, error, scope) {
32
+ var event = LogEvent.log(source, error, LogLevel.Error, scope);
33
+ if (DEBUG && !DEPRECATED_UNIT_TEST) {
34
+ // eslint-disable-next-line no-console
35
+ console.error(event.toString());
36
+ }
37
+ };
38
+ return LogHandler;
39
+ }());
40
+ export default LogHandler;
41
+ //# sourceMappingURL=LogHandler.js.map
@@ -0,0 +1,29 @@
1
+ import type ILogEntry from './ILogEntry';
2
+ import LogType from './LogType';
3
+ /**
4
+ * Represents a Log entry
5
+ *
6
+ * @internal
7
+ */
8
+ declare class LogEntry implements ILogEntry {
9
+ moduleName: string;
10
+ logFeature: string;
11
+ logType: LogType;
12
+ logProperties: Record<string, string | undefined> | undefined;
13
+ isIntentional: boolean | undefined;
14
+ /**
15
+ * Initializes a new instance of LogEntry
16
+ * @param moduleName - the name of the module
17
+ * @param logFeature - the name of the feature
18
+ * @param logType - the log type
19
+ * @param logProperties - optional property bag
20
+ */
21
+ constructor(moduleName: string, logFeature?: string, logType?: LogType, logProperties?: Record<string, string | undefined>, isIntentional?: boolean);
22
+ /**
23
+ * convert the log entry to string
24
+ * @returns the serialized log entry
25
+ */
26
+ toString(): string;
27
+ }
28
+ export default LogEntry;
29
+ //# sourceMappingURL=LogEntry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LogEntry.d.ts","sourceRoot":"","sources":["../../src/Api/LogEntry.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,SAAS,MAAM,aAAa,CAAC;AAEzC,OAAO,OAAO,MAAM,WAAW,CAAC;AAEhC;;;;GAIG;AACH,cAAM,QAAS,YAAW,SAAS;IAC1B,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,OAAO,CAAC;IACjB,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,GAAG,SAAS,CAAC;IAC9D,aAAa,EAAE,OAAO,GAAG,SAAS,CAAC;IAE1C;;;;;;OAMG;gBAED,UAAU,EAAE,MAAM,EAClB,UAAU,GAAE,MAAwB,EACpC,OAAO,GAAE,OAAuB,EAChC,aAAa,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,EAClD,aAAa,CAAC,EAAE,OAAO;IAazB;;;OAGG;IACI,QAAQ,IAAI,MAAM;CAa1B;AAED,eAAe,QAAQ,CAAC"}
@@ -0,0 +1,51 @@
1
+ // Copyright (c) Microsoft. All rights reserved.
2
+ import LogFeature from './LogFeature';
3
+ import LogType from './LogType';
4
+ /**
5
+ * Represents a Log entry
6
+ *
7
+ * @internal
8
+ */
9
+ var LogEntry = /** @class */ (function () {
10
+ /**
11
+ * Initializes a new instance of LogEntry
12
+ * @param moduleName - the name of the module
13
+ * @param logFeature - the name of the feature
14
+ * @param logType - the log type
15
+ * @param logProperties - optional property bag
16
+ */
17
+ function LogEntry(moduleName, logFeature, logType, logProperties, isIntentional) {
18
+ if (logFeature === void 0) { logFeature = LogFeature.None; }
19
+ if (logType === void 0) { logType = LogType.Trace; }
20
+ if (moduleName) {
21
+ this.moduleName = moduleName;
22
+ this.logFeature = logFeature;
23
+ this.logType = logType;
24
+ this.logProperties = logProperties;
25
+ this.isIntentional = isIntentional;
26
+ }
27
+ else {
28
+ throw new Error('moduleName is invalid');
29
+ }
30
+ }
31
+ /**
32
+ * convert the log entry to string
33
+ * @returns the serialized log entry
34
+ */
35
+ LogEntry.prototype.toString = function () {
36
+ var serializedLogProps = undefined;
37
+ if (this.logProperties) {
38
+ try {
39
+ serializedLogProps = JSON.stringify(this.logProperties);
40
+ }
41
+ catch (e) {
42
+ // eslint-disable-next-line no-console
43
+ console.log('Error happens in toString():' + e);
44
+ }
45
+ }
46
+ return "".concat(this.moduleName, " | ").concat(this.logFeature, " | ").concat(this.logType, " | ").concat(serializedLogProps);
47
+ };
48
+ return LogEntry;
49
+ }());
50
+ export default LogEntry;
51
+ //# sourceMappingURL=LogEntry.js.map
@@ -0,0 +1,7 @@
1
+ /**
2
+ * @internal
3
+ */
4
+ export default class LogFeature {
5
+ static None: string;
6
+ }
7
+ //# sourceMappingURL=LogFeature.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LogFeature.d.ts","sourceRoot":"","sources":["../../src/Api/LogFeature.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,CAAC,OAAO,OAAO,UAAU;IAC7B,OAAc,IAAI,EAAE,MAAM,CAAU;CACrC"}
@@ -0,0 +1,11 @@
1
+ /**
2
+ * @internal
3
+ */
4
+ var LogFeature = /** @class */ (function () {
5
+ function LogFeature() {
6
+ }
7
+ LogFeature.None = 'None';
8
+ return LogFeature;
9
+ }());
10
+ export default LogFeature;
11
+ //# sourceMappingURL=LogFeature.js.map
@@ -0,0 +1,23 @@
1
+ /**
2
+ * LogLevel represents the level of a log event.
3
+ * @internal
4
+ */
5
+ export declare enum LogLevel {
6
+ /**
7
+ * verbose event for debugging
8
+ */
9
+ Verbose = 1,
10
+ /**
11
+ * Informational event
12
+ */
13
+ Info = 2,
14
+ /**
15
+ * A warning
16
+ */
17
+ Warning = 3,
18
+ /**
19
+ * An error
20
+ */
21
+ Error = 4
22
+ }
23
+ //# sourceMappingURL=LogLevel.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LogLevel.d.ts","sourceRoot":"","sources":["../../src/Api/LogLevel.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,oBAAY,QAAQ;IAClB;;OAEG;IACH,OAAO,IAAI;IACX;;OAEG;IACH,IAAI,IAAA;IACJ;;OAEG;IACH,OAAO,IAAA;IACP;;OAEG;IACH,KAAK,IAAA;CACN"}
@@ -0,0 +1,24 @@
1
+ /**
2
+ * LogLevel represents the level of a log event.
3
+ * @internal
4
+ */
5
+ export var LogLevel;
6
+ (function (LogLevel) {
7
+ /**
8
+ * verbose event for debugging
9
+ */
10
+ LogLevel[LogLevel["Verbose"] = 1] = "Verbose";
11
+ /**
12
+ * Informational event
13
+ */
14
+ LogLevel[LogLevel["Info"] = 2] = "Info";
15
+ /**
16
+ * A warning
17
+ */
18
+ LogLevel[LogLevel["Warning"] = 3] = "Warning";
19
+ /**
20
+ * An error
21
+ */
22
+ LogLevel[LogLevel["Error"] = 4] = "Error";
23
+ })(LogLevel || (LogLevel = {}));
24
+ //# sourceMappingURL=LogLevel.js.map
@@ -0,0 +1,36 @@
1
+ /**
2
+ * @internal
3
+ */
4
+ export default class CircularBuffer<DataType> {
5
+ /**
6
+ * The size of the buffer
7
+ */
8
+ private _size;
9
+ /**
10
+ * Index of the newest item in the buffer
11
+ */
12
+ private _head;
13
+ /**
14
+ * The overall count of how many items have ever been added to the buffer.
15
+ */
16
+ private _count;
17
+ private _buffer;
18
+ private _isIterating;
19
+ constructor(size: number);
20
+ get count(): number;
21
+ push(item: DataType): void;
22
+ forEach(handle: (value: DataType) => void): void;
23
+ removeAll(): void;
24
+ /**
25
+ * Index of the oldest item in the buffer
26
+ */
27
+ private get _tail();
28
+ private _isNotWrapped;
29
+ /**
30
+ * The next index should be index + 1, unless it reaches
31
+ * the end of the buffer and needs to rewind to 0.
32
+ */
33
+ private _getNext;
34
+ private _ensureNotIterating;
35
+ }
36
+ //# sourceMappingURL=CircularBuffer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CircularBuffer.d.ts","sourceRoot":"","sources":["../../../src/Api/LogManager/CircularBuffer.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,CAAC,OAAO,OAAO,cAAc,CAAC,QAAQ;IAC1C;;OAEG;IACH,OAAO,CAAC,KAAK,CAAS;IACtB;;OAEG;IACH,OAAO,CAAC,KAAK,CAAc;IAC3B;;OAEG;IACH,OAAO,CAAC,MAAM,CAAa;IAC3B,OAAO,CAAC,OAAO,CAAkB;IACjC,OAAO,CAAC,YAAY,CAAkB;gBAEnB,IAAI,EAAE,MAAM;IAQ/B,IAAW,KAAK,IAAI,MAAM,CAEzB;IAEM,IAAI,CAAC,IAAI,EAAE,QAAQ,GAAG,IAAI;IAU1B,OAAO,CAAC,MAAM,EAAE,CAAC,KAAK,EAAE,QAAQ,KAAK,IAAI,GAAG,IAAI;IAqBhD,SAAS,IAAI,IAAI;IAMxB;;OAEG;IACH,OAAO,KAAK,KAAK,GAKhB;IAED,OAAO,CAAC,aAAa;IAIrB;;;OAGG;IACH,OAAO,CAAC,QAAQ;IAQhB,OAAO,CAAC,mBAAmB;CAK5B"}
@@ -0,0 +1,98 @@
1
+ /**
2
+ * @internal
3
+ */
4
+ var CircularBuffer = /** @class */ (function () {
5
+ function CircularBuffer(size) {
6
+ /**
7
+ * Index of the newest item in the buffer
8
+ */
9
+ this._head = -1;
10
+ /**
11
+ * The overall count of how many items have ever been added to the buffer.
12
+ */
13
+ this._count = 0;
14
+ this._isIterating = false;
15
+ if (size <= 0) {
16
+ throw new Error('Size must be positive');
17
+ }
18
+ this._size = size;
19
+ this._buffer = new Array(size);
20
+ }
21
+ Object.defineProperty(CircularBuffer.prototype, "count", {
22
+ get: function () {
23
+ return this._count;
24
+ },
25
+ enumerable: false,
26
+ configurable: true
27
+ });
28
+ CircularBuffer.prototype.push = function (item) {
29
+ this._ensureNotIterating();
30
+ this._head++;
31
+ this._count++;
32
+ if (this._head === this._size) {
33
+ this._head = 0;
34
+ }
35
+ this._buffer[this._head] = item;
36
+ };
37
+ CircularBuffer.prototype.forEach = function (handle) {
38
+ if (this._count === 0) {
39
+ return;
40
+ }
41
+ this._isIterating = true;
42
+ try {
43
+ var current = this._tail;
44
+ // For-loop is prefered over while loop here to avoid possible infinite loop.
45
+ for (var i = 0; i < this._size; i++) {
46
+ handle(this._buffer[current]);
47
+ if (current === this._head) {
48
+ // The newest item has been processed. End the loop.
49
+ break;
50
+ }
51
+ current = this._getNext(current);
52
+ }
53
+ }
54
+ finally {
55
+ this._isIterating = false;
56
+ }
57
+ };
58
+ CircularBuffer.prototype.removeAll = function () {
59
+ this._ensureNotIterating();
60
+ this._head = -1;
61
+ this._count = 0;
62
+ };
63
+ Object.defineProperty(CircularBuffer.prototype, "_tail", {
64
+ /**
65
+ * Index of the oldest item in the buffer
66
+ */
67
+ get: function () {
68
+ if (this._isNotWrapped()) {
69
+ return 0;
70
+ }
71
+ return this._getNext(this._head);
72
+ },
73
+ enumerable: false,
74
+ configurable: true
75
+ });
76
+ CircularBuffer.prototype._isNotWrapped = function () {
77
+ return this._count === this._head + 1;
78
+ };
79
+ /**
80
+ * The next index should be index + 1, unless it reaches
81
+ * the end of the buffer and needs to rewind to 0.
82
+ */
83
+ CircularBuffer.prototype._getNext = function (index) {
84
+ var nextIndex = index + 1;
85
+ if (nextIndex === this._size) {
86
+ nextIndex = 0;
87
+ }
88
+ return nextIndex;
89
+ };
90
+ CircularBuffer.prototype._ensureNotIterating = function () {
91
+ if (this._isIterating) {
92
+ throw new Error('Circular buffer cannot be modified during iteration');
93
+ }
94
+ };
95
+ return CircularBuffer;
96
+ }());
97
+ export default CircularBuffer;
98
+ //# sourceMappingURL=CircularBuffer.js.map