@microsoft/sp-diagnostics 1.23.2 → 1.24.0-beta.3

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 (223) hide show
  1. package/dist/78359e4b-07c2-43c6-8d0b-d060b4d577e8.manifest.json +6 -11
  2. package/dist/index-internal-beta.d.ts +22 -0
  3. package/dist/index-internal-public.d.ts +22 -0
  4. package/dist/index-internal.d.ts +22 -0
  5. package/dist/sp-diagnostics_none_ebdbca9bc199b51d4466.js +1 -0
  6. package/dist/tsdoc-metadata.json +1 -1
  7. package/lib-commonjs/Api/Engagement/EngagementLogger.js +91 -96
  8. package/lib-commonjs/Api/Engagement/IEngagementHandler.js +9 -3
  9. package/lib-commonjs/Api/ExecutionQueue.js +73 -86
  10. package/lib-commonjs/Api/ILogData.js +6 -3
  11. package/lib-commonjs/Api/ILogEntry.js +5 -2
  12. package/lib-commonjs/Api/ILogErrorData.js +6 -3
  13. package/lib-commonjs/Api/ILogSource.js +10 -3
  14. package/lib-commonjs/Api/ILogVerboseData.js +6 -3
  15. package/lib-commonjs/Api/Log/LogHandler.js +27 -26
  16. package/lib-commonjs/Api/LogEntry.js +40 -39
  17. package/lib-commonjs/Api/LogFeature.js +14 -10
  18. package/lib-commonjs/Api/LogLevel.js +22 -19
  19. package/lib-commonjs/Api/LogManager/CircularBuffer.js +56 -64
  20. package/lib-commonjs/Api/LogManager/LogManager.js +61 -78
  21. package/lib-commonjs/Api/LogSource.js +37 -35
  22. package/lib-commonjs/Api/LogType.js +20 -15
  23. package/lib-commonjs/Api/Qos/AutoAlertableQosMonitor.js +68 -82
  24. package/lib-commonjs/Api/Qos/CustomerPromiseInterfaces/ICustomerPromiseErrorDetails.js +5 -2
  25. package/lib-commonjs/Api/Qos/CustomerPromiseInterfaces/IExtraDataForCustomerPromise.js +5 -2
  26. package/lib-commonjs/Api/Qos/IQos.js +5 -2
  27. package/lib-commonjs/Api/Qos/IQosEndEvent.js +5 -2
  28. package/lib-commonjs/Api/Qos/IQosExtraData.js +15 -3
  29. package/lib-commonjs/Api/Qos/IQosStartEvent.js +9 -3
  30. package/lib-commonjs/Api/Qos/QosLogger.js +54 -60
  31. package/lib-commonjs/Api/Qos/QosMonitor.js +163 -209
  32. package/lib-commonjs/Api/Qos/QosMonitorShareFailureWithCP.js +72 -92
  33. package/lib-commonjs/Api/Qos/QosResultType.js +14 -7
  34. package/lib-commonjs/Api/Trace/DefaultTraceHandler.js +20 -22
  35. package/lib-commonjs/Api/Trace/ITraceHandler.js +9 -3
  36. package/lib-commonjs/Api/Trace/ITraceLogger.js +5 -2
  37. package/lib-commonjs/Api/Trace/LogEvent.js +86 -125
  38. package/lib-commonjs/Api/Trace/TraceLogger.js +149 -161
  39. package/lib-commonjs/Diagnostics.js +68 -72
  40. package/lib-commonjs/DiagnosticsSettingsManager.js +48 -43
  41. package/lib-commonjs/IDiagnosticsSettings.js +5 -2
  42. package/lib-commonjs/common/Killswitches.js +13 -9
  43. package/lib-commonjs/extraData/DisplayApp.js +13 -5
  44. package/lib-commonjs/extraData/IDiagnosticContextInfo.js +5 -2
  45. package/lib-commonjs/extraData/IPageExtraData.js +5 -2
  46. package/lib-commonjs/extraData/PageType.js +15 -8
  47. package/lib-commonjs/extraData/PromotedState.js +18 -13
  48. package/lib-commonjs/extraData/WebTemplateId.js +13 -5
  49. package/lib-commonjs/extraData/setPageExtraData.js +37 -37
  50. package/lib-commonjs/index.js +102 -50
  51. package/{lib → lib-dts}/Api/Engagement/IEngagementHandler.d.ts +2 -0
  52. package/{lib → lib-dts}/Diagnostics.d.ts +11 -0
  53. package/{lib → lib-dts}/DiagnosticsSettingsManager.d.ts +4 -0
  54. package/lib-esm/Api/Engagement/EngagementLogger.js +137 -0
  55. package/lib-esm/Api/Engagement/IEngagementHandler.js +9 -0
  56. package/lib-esm/Api/ExecutionQueue.js +114 -0
  57. package/lib-esm/Api/ILogData.js +4 -0
  58. package/lib-esm/Api/ILogEntry.js +3 -0
  59. package/lib-esm/Api/ILogErrorData.js +4 -0
  60. package/lib-esm/Api/ILogSource.js +8 -0
  61. package/lib-esm/Api/ILogVerboseData.js +4 -0
  62. package/lib-esm/Api/Log/LogHandler.js +37 -0
  63. package/lib-esm/Api/LogEntry.js +44 -0
  64. package/lib-esm/Api/LogFeature.js +8 -0
  65. package/lib-esm/Api/LogLevel.js +20 -0
  66. package/lib-esm/Api/LogManager/CircularBuffer.js +83 -0
  67. package/lib-esm/Api/LogManager/LogManager.js +103 -0
  68. package/lib-esm/Api/LogSource.js +32 -0
  69. package/lib-esm/Api/LogType.js +20 -0
  70. package/lib-esm/Api/Qos/AutoAlertableQosMonitor.js +74 -0
  71. package/lib-esm/Api/Qos/CustomerPromiseInterfaces/ICustomerPromiseErrorDetails.js +6 -0
  72. package/lib-esm/Api/Qos/CustomerPromiseInterfaces/IExtraDataForCustomerPromise.js +6 -0
  73. package/lib-esm/Api/Qos/IQos.js +6 -0
  74. package/lib-esm/Api/Qos/IQosEndEvent.js +6 -0
  75. package/lib-esm/Api/Qos/IQosExtraData.js +12 -0
  76. package/lib-esm/Api/Qos/IQosStartEvent.js +6 -0
  77. package/lib-esm/Api/Qos/QosLogger.js +64 -0
  78. package/lib-esm/Api/Qos/QosMonitor.js +258 -0
  79. package/lib-esm/Api/Qos/QosMonitorShareFailureWithCP.js +89 -0
  80. package/lib-esm/Api/Qos/QosResultType.js +11 -0
  81. package/lib-esm/Api/Trace/DefaultTraceHandler.js +23 -0
  82. package/lib-esm/Api/Trace/ITraceHandler.js +9 -0
  83. package/lib-esm/Api/Trace/ITraceLogger.js +3 -0
  84. package/lib-esm/Api/Trace/LogEvent.js +104 -0
  85. package/lib-esm/Api/Trace/TraceLogger.js +180 -0
  86. package/lib-esm/Diagnostics.js +78 -0
  87. package/lib-esm/DiagnosticsSettingsManager.js +65 -0
  88. package/lib-esm/IDiagnosticsSettings.js +3 -0
  89. package/{lib → lib-esm}/common/Killswitches.js +3 -4
  90. package/{lib → lib-esm}/extraData/DisplayApp.js +3 -2
  91. package/lib-esm/extraData/IDiagnosticContextInfo.js +7 -0
  92. package/lib-esm/extraData/IPageExtraData.js +3 -0
  93. package/{lib → lib-esm}/extraData/PageType.js +4 -4
  94. package/lib-esm/extraData/PromotedState.js +15 -0
  95. package/{lib → lib-esm}/extraData/WebTemplateId.js +3 -2
  96. package/{lib → lib-esm}/extraData/setPageExtraData.js +14 -20
  97. package/{lib → lib-esm}/index.js +3 -3
  98. package/package.json +33 -6
  99. package/dist/sp-diagnostics_none_414da724f4073ce8bb98.js +0 -1
  100. package/lib/Api/Engagement/EngagementLogger.d.ts.map +0 -1
  101. package/lib/Api/Engagement/EngagementLogger.js +0 -143
  102. package/lib/Api/Engagement/IEngagementHandler.d.ts.map +0 -1
  103. package/lib/Api/Engagement/IEngagementHandler.js +0 -2
  104. package/lib/Api/ExecutionQueue.d.ts.map +0 -1
  105. package/lib/Api/ExecutionQueue.js +0 -131
  106. package/lib/Api/ILogData.d.ts.map +0 -1
  107. package/lib/Api/ILogData.js +0 -3
  108. package/lib/Api/ILogEntry.d.ts.map +0 -1
  109. package/lib/Api/ILogEntry.js +0 -2
  110. package/lib/Api/ILogErrorData.d.ts.map +0 -1
  111. package/lib/Api/ILogErrorData.js +0 -3
  112. package/lib/Api/ILogSource.d.ts.map +0 -1
  113. package/lib/Api/ILogSource.js +0 -3
  114. package/lib/Api/ILogVerboseData.d.ts.map +0 -1
  115. package/lib/Api/ILogVerboseData.js +0 -3
  116. package/lib/Api/Log/LogHandler.d.ts.map +0 -1
  117. package/lib/Api/Log/LogHandler.js +0 -40
  118. package/lib/Api/LogEntry.d.ts.map +0 -1
  119. package/lib/Api/LogEntry.js +0 -51
  120. package/lib/Api/LogFeature.d.ts.map +0 -1
  121. package/lib/Api/LogFeature.js +0 -11
  122. package/lib/Api/LogLevel.d.ts.map +0 -1
  123. package/lib/Api/LogLevel.js +0 -24
  124. package/lib/Api/LogManager/CircularBuffer.d.ts.map +0 -1
  125. package/lib/Api/LogManager/CircularBuffer.js +0 -98
  126. package/lib/Api/LogManager/LogManager.d.ts.map +0 -1
  127. package/lib/Api/LogManager/LogManager.js +0 -121
  128. package/lib/Api/LogSource.d.ts.map +0 -1
  129. package/lib/Api/LogSource.js +0 -40
  130. package/lib/Api/LogType.d.ts.map +0 -1
  131. package/lib/Api/LogType.js +0 -23
  132. package/lib/Api/Qos/AutoAlertableQosMonitor.d.ts.map +0 -1
  133. package/lib/Api/Qos/AutoAlertableQosMonitor.js +0 -93
  134. package/lib/Api/Qos/CustomerPromiseInterfaces/ICustomerPromiseErrorDetails.d.ts.map +0 -1
  135. package/lib/Api/Qos/CustomerPromiseInterfaces/ICustomerPromiseErrorDetails.js +0 -2
  136. package/lib/Api/Qos/CustomerPromiseInterfaces/IExtraDataForCustomerPromise.d.ts.map +0 -1
  137. package/lib/Api/Qos/CustomerPromiseInterfaces/IExtraDataForCustomerPromise.js +0 -2
  138. package/lib/Api/Qos/IQos.d.ts.map +0 -1
  139. package/lib/Api/Qos/IQos.js +0 -2
  140. package/lib/Api/Qos/IQosEndEvent.d.ts.map +0 -1
  141. package/lib/Api/Qos/IQosEndEvent.js +0 -2
  142. package/lib/Api/Qos/IQosExtraData.d.ts.map +0 -1
  143. package/lib/Api/Qos/IQosExtraData.js +0 -2
  144. package/lib/Api/Qos/IQosStartEvent.d.ts.map +0 -1
  145. package/lib/Api/Qos/IQosStartEvent.js +0 -2
  146. package/lib/Api/Qos/QosLogger.d.ts.map +0 -1
  147. package/lib/Api/Qos/QosLogger.js +0 -74
  148. package/lib/Api/Qos/QosMonitor.d.ts.map +0 -1
  149. package/lib/Api/Qos/QosMonitor.js +0 -304
  150. package/lib/Api/Qos/QosMonitorShareFailureWithCP.d.ts.map +0 -1
  151. package/lib/Api/Qos/QosMonitorShareFailureWithCP.js +0 -114
  152. package/lib/Api/Qos/QosResultType.d.ts.map +0 -1
  153. package/lib/Api/Qos/QosResultType.js +0 -11
  154. package/lib/Api/Trace/DefaultTraceHandler.d.ts.map +0 -1
  155. package/lib/Api/Trace/DefaultTraceHandler.js +0 -30
  156. package/lib/Api/Trace/ITraceHandler.d.ts.map +0 -1
  157. package/lib/Api/Trace/ITraceHandler.js +0 -2
  158. package/lib/Api/Trace/ITraceLogger.d.ts.map +0 -1
  159. package/lib/Api/Trace/ITraceLogger.js +0 -2
  160. package/lib/Api/Trace/LogEvent.d.ts.map +0 -1
  161. package/lib/Api/Trace/LogEvent.js +0 -147
  162. package/lib/Api/Trace/TraceLogger.d.ts.map +0 -1
  163. package/lib/Api/Trace/TraceLogger.js +0 -196
  164. package/lib/Diagnostics.d.ts.map +0 -1
  165. package/lib/Diagnostics.js +0 -82
  166. package/lib/DiagnosticsSettingsManager.d.ts.map +0 -1
  167. package/lib/DiagnosticsSettingsManager.js +0 -62
  168. package/lib/IDiagnosticsSettings.d.ts.map +0 -1
  169. package/lib/IDiagnosticsSettings.js +0 -2
  170. package/lib/common/Killswitches.d.ts.map +0 -1
  171. package/lib/extraData/DisplayApp.d.ts.map +0 -1
  172. package/lib/extraData/IDiagnosticContextInfo.d.ts.map +0 -1
  173. package/lib/extraData/IDiagnosticContextInfo.js +0 -2
  174. package/lib/extraData/IPageExtraData.d.ts.map +0 -1
  175. package/lib/extraData/IPageExtraData.js +0 -2
  176. package/lib/extraData/PageType.d.ts.map +0 -1
  177. package/lib/extraData/PromotedState.d.ts.map +0 -1
  178. package/lib/extraData/PromotedState.js +0 -17
  179. package/lib/extraData/WebTemplateId.d.ts.map +0 -1
  180. package/lib/extraData/setPageExtraData.d.ts.map +0 -1
  181. package/lib/index.d.ts.map +0 -1
  182. /package/{lib → lib-dts}/Api/Engagement/EngagementLogger.d.ts +0 -0
  183. /package/{lib → lib-dts}/Api/ExecutionQueue.d.ts +0 -0
  184. /package/{lib → lib-dts}/Api/ILogData.d.ts +0 -0
  185. /package/{lib → lib-dts}/Api/ILogEntry.d.ts +0 -0
  186. /package/{lib → lib-dts}/Api/ILogErrorData.d.ts +0 -0
  187. /package/{lib → lib-dts}/Api/ILogSource.d.ts +0 -0
  188. /package/{lib → lib-dts}/Api/ILogVerboseData.d.ts +0 -0
  189. /package/{lib → lib-dts}/Api/Log/LogHandler.d.ts +0 -0
  190. /package/{lib → lib-dts}/Api/LogEntry.d.ts +0 -0
  191. /package/{lib → lib-dts}/Api/LogFeature.d.ts +0 -0
  192. /package/{lib → lib-dts}/Api/LogLevel.d.ts +0 -0
  193. /package/{lib → lib-dts}/Api/LogManager/CircularBuffer.d.ts +0 -0
  194. /package/{lib → lib-dts}/Api/LogManager/LogManager.d.ts +0 -0
  195. /package/{lib → lib-dts}/Api/LogSource.d.ts +0 -0
  196. /package/{lib → lib-dts}/Api/LogType.d.ts +0 -0
  197. /package/{lib → lib-dts}/Api/Qos/AutoAlertableQosMonitor.d.ts +0 -0
  198. /package/{lib → lib-dts}/Api/Qos/CustomerPromiseInterfaces/ICustomerPromiseErrorDetails.d.ts +0 -0
  199. /package/{lib → lib-dts}/Api/Qos/CustomerPromiseInterfaces/IExtraDataForCustomerPromise.d.ts +0 -0
  200. /package/{lib → lib-dts}/Api/Qos/IQos.d.ts +0 -0
  201. /package/{lib → lib-dts}/Api/Qos/IQosEndEvent.d.ts +0 -0
  202. /package/{lib → lib-dts}/Api/Qos/IQosExtraData.d.ts +0 -0
  203. /package/{lib → lib-dts}/Api/Qos/IQosStartEvent.d.ts +0 -0
  204. /package/{lib → lib-dts}/Api/Qos/QosLogger.d.ts +0 -0
  205. /package/{lib → lib-dts}/Api/Qos/QosMonitor.d.ts +0 -0
  206. /package/{lib → lib-dts}/Api/Qos/QosMonitorShareFailureWithCP.d.ts +0 -0
  207. /package/{lib → lib-dts}/Api/Qos/QosResultType.d.ts +0 -0
  208. /package/{lib → lib-dts}/Api/Trace/DefaultTraceHandler.d.ts +0 -0
  209. /package/{lib → lib-dts}/Api/Trace/ITraceHandler.d.ts +0 -0
  210. /package/{lib → lib-dts}/Api/Trace/ITraceLogger.d.ts +0 -0
  211. /package/{lib → lib-dts}/Api/Trace/LogEvent.d.ts +0 -0
  212. /package/{lib → lib-dts}/Api/Trace/TraceLogger.d.ts +0 -0
  213. /package/{lib → lib-dts}/IDiagnosticsSettings.d.ts +0 -0
  214. /package/{lib → lib-dts}/common/Killswitches.d.ts +0 -0
  215. /package/{lib → lib-dts}/extraData/DisplayApp.d.ts +0 -0
  216. /package/{lib → lib-dts}/extraData/IDiagnosticContextInfo.d.ts +0 -0
  217. /package/{lib → lib-dts}/extraData/IPageExtraData.d.ts +0 -0
  218. /package/{lib → lib-dts}/extraData/PageType.d.ts +0 -0
  219. /package/{lib → lib-dts}/extraData/PromotedState.d.ts +0 -0
  220. /package/{lib → lib-dts}/extraData/WebTemplateId.d.ts +0 -0
  221. /package/{lib → lib-dts}/extraData/setPageExtraData.d.ts +0 -0
  222. /package/{lib → lib-dts}/index.d.ts +0 -0
  223. /package/{lib → lib-esm}/sp-diagnostics.manifest.json +0 -0
@@ -1,304 +0,0 @@
1
- import { _BrowserUtilities, _SPKillSwitch } from '@microsoft/sp-core-library';
2
- // Copyright (c) Microsoft. All rights reserved.
3
- import { Guid, Text, Validate } from '@microsoft/sp-core-library';
4
- import { getErrorMessage, getQosEndSchemaFromError, CustomError } from '@msinternal/odsp-core-bundle';
5
- import TraceLogger from '../Trace/TraceLogger';
6
- import { QosResultType } from './QosResultType';
7
- import QosLogger from './QosLogger';
8
- import EngagementLogger from '../Engagement/EngagementLogger';
9
- import Diagnostics from '../../Diagnostics';
10
- import DiagnosticsSettingsManager from '../../DiagnosticsSettingsManager';
11
- import { merge } from '@microsoft/sp-lodash-subset';
12
- var LOG_SOURCE = {
13
- id: 'QosMonitor'
14
- };
15
- var QOS_MONISTOR_HAS_ENDED_ERROR_STRING = "QoS monitor '{0}' has ended with '{1}' already. Ignoring '{2}' tag.";
16
- var AUTHORING_SESSION_ID_KEY = 'AuthoringSessionId';
17
- var AUTHORING_OP_SEQUENCE_ID_KEY = 'AuthoringOpSequenceId';
18
- var AUTHORING_SESSION_CLIENT_COUNT = 'AuthoringSessionClientCount';
19
- /**
20
- * Qos logger
21
- * This class represents the Qos monitor APIs
22
- *
23
- * @internal
24
- */
25
- var QosMonitor = /** @class */ (function () {
26
- /**
27
- * Creates a QoS monitor (initializes it and logs the start event)
28
- * @param scenarioName - Unique name of the QoS scenario
29
- * You will see start tag: SPPages.ScenarioName.Start
30
- * @param copyToCosmos - Indicate whether this data should be used as Engagement as well, and sent to COSMOS.
31
- * @param copyToInterana - Indicate whether this data should be used as Engagement as well, and sent to Interana.
32
- */
33
- function QosMonitor(scenarioName, copyToCosmos, copyToInterana) {
34
- var _a;
35
- if (copyToCosmos === void 0) { copyToCosmos = false; }
36
- if (copyToInterana === void 0) { copyToInterana = false; }
37
- var _this = this;
38
- this._qosResultTypeValue = (_a = {},
39
- _a[QosResultType.Success] = 'Success',
40
- _a[QosResultType.Failure] = 'Failure',
41
- _a[QosResultType.ExpectedFailure] = 'ExpectedFailure',
42
- _a);
43
- this._ensureAuthoringSessionId = function () {
44
- var _a, _b, _c, _d;
45
- var authoringSessionId = (_b = (_a = DiagnosticsSettingsManager.settings) === null || _a === void 0 ? void 0 : _a.extraDiagnosticInfo) === null || _b === void 0 ? void 0 : _b.authoringSessionId;
46
- if (authoringSessionId) {
47
- _this._ensureEndExtraData();
48
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
49
- _this._endExtraData[AUTHORING_SESSION_ID_KEY] = authoringSessionId;
50
- var authoringOpSequenceId = (_d = (_c = DiagnosticsSettingsManager.settings) === null || _c === void 0 ? void 0 : _c.extraDiagnosticInfo) === null || _d === void 0 ? void 0 : _d.authoringOpSequenceId;
51
- if (authoringOpSequenceId) {
52
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
53
- _this._endExtraData[AUTHORING_OP_SEQUENCE_ID_KEY] = authoringOpSequenceId;
54
- }
55
- var authoringSessionClientCount = Diagnostics.getAuthoringSessionClientCountInfo();
56
- if (authoringSessionClientCount && _this._endExtraData) {
57
- _this._endExtraData[AUTHORING_SESSION_CLIENT_COUNT] = authoringSessionClientCount;
58
- }
59
- }
60
- };
61
- Validate.isNonemptyString(scenarioName, 'scenarioName');
62
- this._id = Guid.newGuid().toString();
63
- if (!this._isDebugSession()) {
64
- QosLogger.instance.startQosMonitor(this._id, { name: scenarioName });
65
- }
66
- this._scenarioName = scenarioName;
67
- this._hasEnded = false;
68
- this._copyToCosmos = copyToCosmos;
69
- this._copyToInterana = copyToInterana;
70
- }
71
- QosMonitor.startRealTimeProcessing = function () {
72
- if (!QosLogger.instance.shouldProcessInRealTime) {
73
- this._shouldProcessInRealTime(true);
74
- }
75
- };
76
- /**
77
- * Only used in unit tests
78
- * @internal
79
- */
80
- QosMonitor._shouldProcessInRealTime = function (processInRealTime) {
81
- QosLogger.instance.shouldProcessInRealTime = processInRealTime;
82
- };
83
- Object.defineProperty(QosMonitor.prototype, "name", {
84
- get: function () {
85
- return this._scenarioName;
86
- },
87
- enumerable: false,
88
- configurable: true
89
- });
90
- Object.defineProperty(QosMonitor.prototype, "shortEventName", {
91
- get: function () {
92
- return 'Qos';
93
- },
94
- enumerable: false,
95
- configurable: true
96
- });
97
- Object.defineProperty(QosMonitor.prototype, "resultCode", {
98
- get: function () {
99
- return this._endResultCode;
100
- },
101
- enumerable: false,
102
- configurable: true
103
- });
104
- Object.defineProperty(QosMonitor.prototype, "resultType", {
105
- get: function () {
106
- return this._endResult;
107
- },
108
- enumerable: false,
109
- configurable: true
110
- });
111
- Object.defineProperty(QosMonitor.prototype, "extraData", {
112
- get: function () {
113
- return this._endExtraData;
114
- },
115
- set: function (value) {
116
- this._endExtraData = value;
117
- },
118
- enumerable: false,
119
- configurable: true
120
- });
121
- Object.defineProperty(QosMonitor.prototype, "hasEnded", {
122
- get: function () {
123
- return this._hasEnded;
124
- },
125
- enumerable: false,
126
- configurable: true
127
- });
128
- /**
129
- * QoS monitor ends with success
130
- * You will see success tag: SPPages.ScenarioName.Success
131
- */
132
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
133
- QosMonitor.prototype.writeSuccess = function (extraData) {
134
- this._writeQosEnd(QosResultType.Success, undefined, undefined, extraData);
135
- };
136
- /**
137
- * QoS monitor ends with failure
138
- * You will see failure tag: SPPages.ScenarioName.<failuretag>.Failure.
139
- * <failuretag> will be filled with param tagName
140
- */
141
- QosMonitor.prototype.writeUnexpectedFailure = function (tagNameSuffix, ex,
142
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
143
- extraData) {
144
- if (tagNameSuffix === void 0) { tagNameSuffix = 'DefaultUnexpected'; }
145
- this._writeQosEnd(QosResultType.Failure, tagNameSuffix, ex, extraData);
146
- };
147
- /*
148
- * QoS monitor ends with expected failure
149
- * You will see success tag: ModernPublish.RenderPublishPage.<failuretag>.ExpectedFailure.
150
- * <failuretag> will be filled with param tagName
151
- */
152
- QosMonitor.prototype.writeExpectedFailure = function (tagNameSuffix, ex,
153
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
154
- extraData) {
155
- if (tagNameSuffix === void 0) { tagNameSuffix = 'DefaultExpected'; }
156
- this._writeQosEnd(QosResultType.ExpectedFailure, tagNameSuffix, ex, extraData);
157
- };
158
- QosMonitor.prototype._writeQosEnd = function (resultType, tagNameSuffix, ex,
159
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
160
- extraData) {
161
- if (this._shouldSkip(resultType)) {
162
- return;
163
- }
164
- this._ensureCorrelationId(resultType, extraData);
165
- this._endResultCode = tagNameSuffix;
166
- this._endResult = resultType;
167
- var errorString = !ex ? undefined : getErrorMessage(ex);
168
- if (ex instanceof CustomError) {
169
- var endSchema = getQosEndSchemaFromError(ex);
170
- if (endSchema) {
171
- endSchema.resultType = this._endResult;
172
- // Make sure the extraData from `endSchema` takes priority so that
173
- // extra data like correlation id from the error object is logged
174
- // instead of the generic extra data from `_endExtraData`.
175
- endSchema.extraData = merge({}, this._endExtraData, endSchema.extraData);
176
- }
177
- QosLogger.instance.writeQosEndResult(this._id, endSchema);
178
- }
179
- else {
180
- var endData = {
181
- resultCode: this._endResultCode,
182
- resultType: this._endResult,
183
- error: errorString,
184
- extraData: this._endExtraData
185
- };
186
- QosLogger.instance.writeQosEndResult(this._id, endData);
187
- }
188
- this._writeToEngagement();
189
- };
190
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
191
- QosMonitor.prototype._ensureCorrelationId = function (resultType, extraData) {
192
- var _this = this;
193
- if (extraData) {
194
- this._ensureEndExtraData();
195
- // Instead of slower ...[spread], copy over the incoming values manually
196
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
197
- Object.keys(extraData).forEach(function (k) { return (_this._endExtraData[k] = extraData[k]); });
198
- }
199
- if (DiagnosticsSettingsManager.isInitialized && resultType !== QosResultType.Success) {
200
- var capitalKey = 'CorrelationId';
201
- var lowerKey = 'correlationId';
202
- var correlationId = ((this._endExtraData &&
203
- (this._endExtraData[capitalKey] || this._endExtraData[lowerKey])) ||
204
- DiagnosticsSettingsManager.settings.correlationId);
205
- if (correlationId) {
206
- if (!this._endExtraData) {
207
- this._endExtraData = {};
208
- }
209
- this._endExtraData[capitalKey] = correlationId;
210
- }
211
- }
212
- this._logHostType();
213
- this._ensureAuthoringSessionId();
214
- };
215
- QosMonitor.prototype._ensureEndExtraData = function () {
216
- if (!this._endExtraData) {
217
- this._endExtraData = {};
218
- }
219
- };
220
- /**
221
- * Logs the application hosted in Teams in combination with which Teams application it was hosted on.
222
- * Viva1p-TeamsNative: Viva home app loaded through Teams Desktop application, not including mobile
223
- * Viva1p-TeamsWeb: Viva home app loaded through Teams Web browser, not including mobile
224
- * MEEBridge-TeamsNative: VivaConnections MEEBridge app loaded through Teams mobile client.
225
- * ClassHome-TeamsNative: ClassHome app loaded through Teams Desktop application, not including mobile
226
- * ClassHome-TeamsWeb: ClassHome app loaded through Teams Web browser, not including mobile
227
- */
228
- QosMonitor.prototype._logHostType = function () {
229
- if (DiagnosticsSettingsManager.isInitialized) {
230
- var appHostType = _BrowserUtilities.getTeamsAppType();
231
- // Skip logging for default SPO path for now to limit quota impact
232
- if (appHostType) {
233
- this._ensureEndExtraData();
234
- var hostKey = 'appHostType';
235
- // Unlikely, but avoid overwriting matching key value
236
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
237
- if (!this._endExtraData[hostKey]) {
238
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
239
- this._endExtraData[hostKey] = appHostType;
240
- }
241
- }
242
- }
243
- };
244
- QosMonitor.prototype._isDebugSession = function () {
245
- try {
246
- if (!_SPKillSwitch.isActivated('761ccb86-4fa0-4f56-a05b-477bcc09bd9f' /* '08/01/2024', 'finnnavin: Let QoSMonitor run in debug, uploading is blocked at SDK-level.' */)) {
247
- return false;
248
- }
249
- else {
250
- return !!_BrowserUtilities.safelyAccessSessionStorage('spfx-debug');
251
- }
252
- }
253
- catch (_a) {
254
- // KillSwitches throw exceptions when not initialized.
255
- // Currently this only happens when spfx-debug is present, so telemetry isn't being logged by the handler, and we can return false.
256
- return false;
257
- }
258
- };
259
- QosMonitor.prototype._shouldSkip = function (result) {
260
- if (this._hasEnded && this._endResult !== undefined) {
261
- var message = Text.format(QOS_MONISTOR_HAS_ENDED_ERROR_STRING, this.name, this._qosResultTypeValue[this._endResult], this._qosResultTypeValue[result]);
262
- if (this._endResult !== result) {
263
- TraceLogger.logError(LOG_SOURCE, new Error(message));
264
- }
265
- if (DEBUG) {
266
- TraceLogger.logVerbose(LOG_SOURCE, message, 'skipEnd');
267
- }
268
- return true;
269
- }
270
- else {
271
- this._hasEnded = true;
272
- return this._isDebugSession();
273
- }
274
- };
275
- QosMonitor.prototype._writeToEngagement = function () {
276
- if (this._copyToInterana) {
277
- EngagementLogger.log({
278
- name: this.name,
279
- isIntentional: !!(this.extraData || {}).isIntentional,
280
- extraData: this.extraData || {}
281
- });
282
- }
283
- if (this._copyToCosmos) {
284
- // Engagement name requires certain format. Cannot just use QOS name.
285
- // Record Qos name in extra data 'qosName'
286
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
287
- var engagementData = {
288
- name: 'Spfx.Qos.ToEngagement',
289
- extraData: this.extraData || {}
290
- };
291
- engagementData.extraData.qosName = this.name;
292
- if (this.resultType) {
293
- engagementData.extraData.qosResultType = this._qosResultTypeValue[this.resultType];
294
- }
295
- if (this.resultCode) {
296
- engagementData.extraData.qosResultCode = this.resultCode;
297
- }
298
- EngagementLogger.log(engagementData);
299
- }
300
- };
301
- return QosMonitor;
302
- }());
303
- export default QosMonitor;
304
- //# sourceMappingURL=QosMonitor.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"QosMonitorShareFailureWithCP.d.ts","sourceRoot":"","sources":["../../../src/Api/Qos/QosMonitorShareFailureWithCP.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,0DAA0D,CAAC;AAC7G,OAAO,UAAU,MAAM,cAAc,CAAC;AAItC;;;GAGG;AACH,qBAAa,4BAA6B,SAAQ,UAAU;IAC1D,OAAO,CAAC,4BAA4B,CAAiC;IACrE;;;;;;;;OAQG;gBAED,YAAY,EAAE,MAAM,EACpB,gBAAgB,qBAAiB,EACjC,2BAA2B,EAAE,4BAA4B,EAAE,EAC3D,YAAY,GAAE,OAAe;IAK/B;;;;;;;OAOG;IACI,sBAAsB,CAC3B,aAAa,GAAE,MAA4B,EAC3C,EAAE,CAAC,EAAE,KAAK,EAEV,SAAS,CAAC,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;KAAE,GACjC,IAAI;IASP;;;;;;;OAOG;IACI,oBAAoB,CACzB,aAAa,GAAE,MAA0B,EACzC,EAAE,CAAC,EAAE,KAAK,EAEV,SAAS,CAAC,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;KAAE,EAClC,iCAAiC,GAAE,OAAe,GACjD,IAAI;IAaP;;;;;;OAMG;IACH,OAAO,CAAC,0BAA0B;CA2BnC"}
@@ -1,114 +0,0 @@
1
- import { __extends } from "tslib";
2
- import QosMonitor from './QosMonitor';
3
- import { QosResultType } from './QosResultType';
4
- import { _Diagnostics } from '../../index';
5
- import { isAppendSuffixIfBrowserIsOfflineAtLoggingTimeKsActive } from '../../common/Killswitches';
6
- /**
7
- * Monitor which handles failures for QosMonitor and also invokes Customer Promise Handlers to record failure
8
- * @internal
9
- */
10
- var QosMonitorShareFailureWithCP = /** @class */ (function (_super) {
11
- __extends(QosMonitorShareFailureWithCP, _super);
12
- /**
13
- * Creates a QoS monitor and also registers the Customer promise handlers to notify in case of failures
14
- * @internal
15
- *
16
- * @param scenarioName - Unique name of the QoS scenario
17
- * @param copyToEngagement - indicate whether this data should be used as Engagement as well.
18
- * @param extraDataForCustomerPromise - Holds extra information about Customer Promise handlers to invoke
19
- * and error information where failures are logged
20
- */
21
- function QosMonitorShareFailureWithCP(scenarioName, copyToEngagement, extraDataForCustomerPromise, copyToCosmos) {
22
- if (copyToEngagement === void 0) { copyToEngagement = false; }
23
- if (copyToCosmos === void 0) { copyToCosmos = false; }
24
- var _this = _super.call(this, scenarioName, /* copyToCosmos */ copyToCosmos, /* copyToInterana */ copyToEngagement) || this;
25
- _this._extraDataForCustomerPromise = extraDataForCustomerPromise;
26
- return _this;
27
- }
28
- /**
29
- * QoS monitor ends with failure and invokes the Customer Promise handlers
30
- * to log a failure
31
- * @internal
32
- *
33
- * You will see failure tag: SPPages.ScenarioName.<failuretag>.Failure.
34
- * <failuretag> will be filled with param tagName
35
- */
36
- QosMonitorShareFailureWithCP.prototype.writeUnexpectedFailure = function (tagNameSuffix, ex,
37
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
38
- extraData) {
39
- if (tagNameSuffix === void 0) { tagNameSuffix = 'DefaultUnexpected'; }
40
- _super.prototype.writeUnexpectedFailure.call(this, tagNameSuffix, ex, extraData);
41
- this._logCustomerPromiseFailure((ex === null || ex === void 0 ? void 0 : ex.message) || 'DefaultErrorMessage', tagNameSuffix, QosResultType.Failure, extraData);
42
- };
43
- /**
44
- * QoS monitor ends with expected failure and invokes the Customer Promise handlers
45
- * to log an expected failure
46
- * @internal
47
- *
48
- * You will see success tag: ModernPublish.RenderPublishPage.<failuretag>.ExpectedFailure.
49
- * <failuretag> will be filled with param tagName
50
- */
51
- QosMonitorShareFailureWithCP.prototype.writeExpectedFailure = function (tagNameSuffix, ex,
52
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
53
- extraData, skipLoggingCustomerPromiseFailure) {
54
- if (tagNameSuffix === void 0) { tagNameSuffix = 'DefaultExpected'; }
55
- if (skipLoggingCustomerPromiseFailure === void 0) { skipLoggingCustomerPromiseFailure = false; }
56
- _super.prototype.writeExpectedFailure.call(this, tagNameSuffix, ex, extraData);
57
- if (!skipLoggingCustomerPromiseFailure) {
58
- this._logCustomerPromiseFailure((ex === null || ex === void 0 ? void 0 : ex.message) || 'DefaultErrorMessage', tagNameSuffix, QosResultType.ExpectedFailure, extraData);
59
- }
60
- };
61
- /**
62
- * Invokes the registered Customer Promise Handlers by using the passed in serviceKey
63
- * @param errorMessage - Information to indicate which scenario failed.
64
- * @param errorScenario -Additional error details describing the failure from the module.
65
- * @param resultType - ResultTypeEnum used to indicate expected or unexpected failure.
66
- * @param extraData - Additional information to be logged, which might include pageType and/or errorStack
67
- */
68
- QosMonitorShareFailureWithCP.prototype._logCustomerPromiseFailure = function (errorMessage, errorScenario, resultType,
69
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
70
- extraData) {
71
- if (resultType === void 0) { resultType = QosResultType.Failure; }
72
- if (this._extraDataForCustomerPromise) {
73
- this._extraDataForCustomerPromise.forEach(function (extraHandlerInfo) {
74
- var logFailure = extraHandlerInfo.logFailure, veto = extraHandlerInfo.veto;
75
- var errorModuleName = extraHandlerInfo.errorModuleName +
76
- getAuthoringSuffix() +
77
- (!isAppendSuffixIfBrowserIsOfflineAtLoggingTimeKsActive() ? getOfflineSuffix() : '');
78
- var errorDetailsForCP = {
79
- errorCode: errorModuleName,
80
- errorScenario: errorScenario,
81
- errorMessage: errorMessage,
82
- resultType: resultType,
83
- pageType: extraData === null || extraData === void 0 ? void 0 : extraData.pageType,
84
- errorStack: extraData === null || extraData === void 0 ? void 0 : extraData.errorStack,
85
- veto: veto
86
- };
87
- logFailure(errorDetailsForCP);
88
- });
89
- }
90
- };
91
- return QosMonitorShareFailureWithCP;
92
- }(QosMonitor));
93
- export { QosMonitorShareFailureWithCP };
94
- function getAuthoringSuffix() {
95
- var extraDiagnosticInfo = _Diagnostics._getExtraDiagnosticInfo();
96
- if (!extraDiagnosticInfo || !extraDiagnosticInfo.hasAuthoringStarted) {
97
- return '';
98
- }
99
- else if (!extraDiagnosticInfo.authoringSessionClientCount) {
100
- return extraDiagnosticInfo.isAuthoringUsingDDS
101
- ? " in Legacy Authoring (DDS)"
102
- : ' in Legacy Authoring (no DDS)';
103
- }
104
- else if (extraDiagnosticInfo.authoringSessionClientCount > 1) {
105
- return ' with Multiple Users';
106
- }
107
- else {
108
- return '';
109
- }
110
- }
111
- function getOfflineSuffix() {
112
- return window.navigator.onLine ? '' : ' (offline)';
113
- }
114
- //# sourceMappingURL=QosMonitorShareFailureWithCP.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"QosResultType.d.ts","sourceRoot":"","sources":["../../../src/Api/Qos/QosResultType.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,eAAO,MAAM,aAAa;;;;CAIhB,CAAC;AAEX;;;GAGG;AAEH,MAAM,MAAM,aAAa,GAAG,CAAC,OAAO,aAAa,CAAC,CAAC,MAAM,OAAO,aAAa,CAAC,CAAC"}
@@ -1,11 +0,0 @@
1
- /**
2
- * Qos Result Type const object.
3
- * @internal
4
- */
5
- // eslint-disable-next-line @typescript-eslint/typedef
6
- export var QosResultType = {
7
- Success: 0,
8
- Failure: 1,
9
- ExpectedFailure: 2
10
- };
11
- //# sourceMappingURL=QosResultType.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"DefaultTraceHandler.d.ts","sourceRoot":"","sources":["../../../src/Api/Trace/DefaultTraceHandler.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,cAAc,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AAE5F;;GAEG;AACH,MAAM,CAAC,OAAO,OAAO,mBAAoB,YAAW,aAAa;IAC/D;;OAEG;IACI,GAAG,CAAC,aAAa,EAAE,cAAc,GAAG,IAAI;IAW/C;;OAEG;IACI,OAAO,CAAC,iBAAiB,EAAE,qBAAqB,GAAG,IAAI;CAM/D"}
@@ -1,30 +0,0 @@
1
- /**
2
- * Default implementation for the Trace logger class.
3
- */
4
- var DefaultTraceHandler = /** @class */ (function () {
5
- function DefaultTraceHandler() {
6
- }
7
- /**
8
- * Default implementation for log function.
9
- */
10
- DefaultTraceHandler.prototype.log = function (traceLogEvent) {
11
- if (!DEPRECATED_UNIT_TEST) {
12
- // eslint-disable-next-line no-console
13
- console.log("Error: ".concat(traceLogEvent.data, ", ") +
14
- "Event Name: ".concat(traceLogEvent.eventName, ", ") +
15
- "Result Code: ".concat(traceLogEvent.resultCode));
16
- }
17
- };
18
- /**
19
- * Default implementation for verbose function.
20
- */
21
- DefaultTraceHandler.prototype.verbose = function (verboseTraceEvent) {
22
- if (!DEPRECATED_UNIT_TEST) {
23
- // eslint-disable-next-line no-console
24
- console.log("Error: ".concat(verboseTraceEvent.data, ", Event Name: ").concat(verboseTraceEvent.eventName));
25
- }
26
- };
27
- return DefaultTraceHandler;
28
- }());
29
- export default DefaultTraceHandler;
30
- //# sourceMappingURL=DefaultTraceHandler.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ITraceHandler.d.ts","sourceRoot":"","sources":["../../../src/Api/Trace/ITraceHandler.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,WAAW,aAAa;IAC5B,+BAA+B;IAC/B,GAAG,CAAC,UAAU,EAAE,cAAc,GAAG,IAAI,CAAC;IAEtC,uCAAuC;IACvC,OAAO,CAAC,iBAAiB,EAAE,qBAAqB,GAAG,IAAI,CAAC;CACzD;AAED;;;GAGG;AACH,MAAM,WAAW,qBAAqB;IACpC,8BAA8B;IAC9B,IAAI,EAAE,MAAM,GAAG,KAAK,CAAC;IAErB,oCAAoC;IACpC,SAAS,EAAE,MAAM,CAAC;CACnB;AAED;;;GAGG;AACH,MAAM,WAAW,cAAe,SAAQ,qBAAqB;IAC3D,qCAAqC;IACrC,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB"}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=ITraceHandler.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ITraceLogger.d.ts","sourceRoot":"","sources":["../../../src/Api/Trace/ITraceLogger.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,SAAS,MAAM,cAAc,CAAC;AAC1C,OAAO,KAAK,UAAU,MAAM,eAAe,CAAC;AAE5C;;GAEG;AACH,UAAU,YAAY;IACpB,QAAQ,CAAC,MAAM,EAAE,UAAU,EAAE,KAAK,EAAE,KAAK,EAAE,SAAS,CAAC,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1F,UAAU,CAAC,MAAM,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1E,oBAAoB,CAClB,MAAM,EAAE,UAAU,EAClB,QAAQ,EAAE,SAAS,EACnB,SAAS,CAAC,EAAE,MAAM,EAClB,UAAU,CAAC,EAAE,MAAM,GAClB,IAAI,CAAC;IACR,sBAAsB,CAAC,MAAM,EAAE,UAAU,EAAE,QAAQ,EAAE,SAAS,EAAE,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC3F;AAED,eAAe,YAAY,CAAC"}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=ITraceLogger.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"LogEvent.d.ts","sourceRoot":"","sources":["../../../src/Api/Trace/LogEvent.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC/D,OAAO,EAAE,KAAK,OAAO,IAAI,SAAS,EAAuB,MAAM,cAAc,CAAC;AAC9E,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,UAAU,MAAM,0BAA0B,CAAC;AAElD;;;GAGG;AACH,MAAM,CAAC,OAAO,OAAO,QAAQ;IAC3B;;OAEG;IACH,OAAc,UAAU,EAAE,UAAU,CAAC,QAAQ,CAAC,CAA8B;IAE5E,OAAO,CAAC,UAAU,CAAS;IAC3B,OAAO,CAAC,MAAM,CAAwB;IACtC,OAAO,CAAC,OAAO,CAAS;IACxB,OAAO,CAAC,QAAQ,CAAqB;IACrC,OAAO,CAAC,MAAM,CAAoB;IAClC,OAAO,CAAC,MAAM,CAAW;IACzB,OAAO,CAAC,OAAO,CAAS;IAExB;;;;;;;OAOG;WACW,GAAG,CACf,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,MAAM,GAAG,KAAK,EACpB,KAAK,EAAE,QAAQ,EACf,YAAY,CAAC,EAAE,YAAY,GAC1B,QAAQ;IAMX;;OAEG;gBACgB,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,YAAY,CAAC,EAAE,YAAY;IAU9F,QAAQ,IAAI,MAAM;IAWzB,IAAW,SAAS,IAAI,MAAM,CAE7B;IAED,IAAW,KAAK,IAAI,QAAQ,CAE3B;IAED,IAAW,MAAM,IAAI,MAAM,CAE1B;IAED,IAAW,KAAK,IAAI,SAAS,GAAG,SAAS,CAExC;IAED,IAAW,MAAM,IAAI,MAAM,CAE1B;IAED,IAAW,OAAO,IAAI,MAAM,GAAG,SAAS,CAEvC;IAED,IAAW,KAAK,IAAI,KAAK,GAAG,SAAS,CAEpC;IAED,OAAO,KAAK,gBAAgB,GAE3B;IAED,OAAO,KAAK,iBAAiB,GAE5B;IAED,OAAO,CAAC,SAAS;IASjB,OAAO,CAAC,QAAQ;IAQhB,OAAO,CAAC,UAAU;IAQlB,OAAO,CAAC,SAAS;CAUlB"}
@@ -1,147 +0,0 @@
1
- import { logSourceServiceKey } from '../LogSource';
2
- import LogManager from '../LogManager/LogManager';
3
- /**
4
- * An object that represents one log event.
5
- * @internal
6
- */
7
- var LogEvent = /** @class */ (function () {
8
- /**
9
- * Do not call this constructor directly. Use LogEvent.log instead.
10
- */
11
- function LogEvent(source, data, level, serviceScope) {
12
- this._validate(source, data);
13
- this._timestamp = new Date().getTime();
14
- this._scope = this._getScope(serviceScope);
15
- this._source = source.substr(0, this._maxSourceLength);
16
- this._setData(data);
17
- this._level = level;
18
- this._prefix = this._getPrefix();
19
- }
20
- /**
21
- * Use this method to log an event.
22
- *
23
- * @param source - source of the log event, e.g. class name of the source file
24
- * @param data - data of the log event
25
- * @param level - level of the log event
26
- * @param serviceScope - scope of the log event, e.g. component/web part
27
- */
28
- LogEvent.log = function (source, data, level, serviceScope) {
29
- var event = new LogEvent(source, data, level, serviceScope);
30
- LogEvent.logManager.log(event);
31
- return event;
32
- };
33
- LogEvent.prototype.toString = function () {
34
- var timedPrefix = "[".concat(this._timestamp, "][").concat(this._prefix, "]");
35
- if (this._message) {
36
- return "".concat(timedPrefix, " ").concat(this._message);
37
- }
38
- else if (this._error) {
39
- return "".concat(timedPrefix, " ").concat(this._error.toString());
40
- }
41
- else {
42
- return timedPrefix;
43
- }
44
- };
45
- Object.defineProperty(LogEvent.prototype, "timestamp", {
46
- get: function () {
47
- return this._timestamp;
48
- },
49
- enumerable: false,
50
- configurable: true
51
- });
52
- Object.defineProperty(LogEvent.prototype, "level", {
53
- get: function () {
54
- return this._level;
55
- },
56
- enumerable: false,
57
- configurable: true
58
- });
59
- Object.defineProperty(LogEvent.prototype, "prefix", {
60
- get: function () {
61
- return this._prefix;
62
- },
63
- enumerable: false,
64
- configurable: true
65
- });
66
- Object.defineProperty(LogEvent.prototype, "scope", {
67
- get: function () {
68
- return this._scope;
69
- },
70
- enumerable: false,
71
- configurable: true
72
- });
73
- Object.defineProperty(LogEvent.prototype, "source", {
74
- get: function () {
75
- return this._source;
76
- },
77
- enumerable: false,
78
- configurable: true
79
- });
80
- Object.defineProperty(LogEvent.prototype, "message", {
81
- get: function () {
82
- return this._message;
83
- },
84
- enumerable: false,
85
- configurable: true
86
- });
87
- Object.defineProperty(LogEvent.prototype, "error", {
88
- get: function () {
89
- return this._error;
90
- },
91
- enumerable: false,
92
- configurable: true
93
- });
94
- Object.defineProperty(LogEvent.prototype, "_maxSourceLength", {
95
- get: function () {
96
- return 30;
97
- },
98
- enumerable: false,
99
- configurable: true
100
- });
101
- Object.defineProperty(LogEvent.prototype, "_maxMessageLength", {
102
- get: function () {
103
- return 150;
104
- },
105
- enumerable: false,
106
- configurable: true
107
- });
108
- LogEvent.prototype._validate = function (source, data) {
109
- if (!source) {
110
- throw new Error('source cannot be undefined or null for Logger');
111
- }
112
- if (!data) {
113
- throw new Error('data cannot be undefined or null');
114
- }
115
- };
116
- LogEvent.prototype._setData = function (data) {
117
- if (typeof data === 'string') {
118
- this._message = data.substr(0, this._maxMessageLength);
119
- }
120
- else if (data instanceof Error) {
121
- this._error = data;
122
- }
123
- };
124
- LogEvent.prototype._getPrefix = function () {
125
- var prefix = "".concat(this._source);
126
- if (this._scope && !this._scope.isEmpty()) {
127
- prefix = "".concat(this._scope.id.substr(0, this._maxSourceLength), ".").concat(prefix);
128
- }
129
- return "".concat(prefix);
130
- };
131
- LogEvent.prototype._getScope = function (serviceScope) {
132
- var parentSource;
133
- if (serviceScope) {
134
- serviceScope.whenFinished(function () {
135
- parentSource = serviceScope.consume(logSourceServiceKey);
136
- });
137
- }
138
- return parentSource;
139
- };
140
- /**
141
- * Allows process log events.
142
- */
143
- LogEvent.logManager = new LogManager();
144
- return LogEvent;
145
- }());
146
- export default LogEvent;
147
- //# sourceMappingURL=LogEvent.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"TraceLogger.d.ts","sourceRoot":"","sources":["../../../src/Api/Trace/TraceLogger.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,SAAS,MAAM,cAAc,CAAC;AAC1C,OAAO,KAAK,UAAU,MAAM,eAAe,CAAC;AAG5C,OAAO,KAAK,aAAa,MAAM,kBAAkB,CAAC;AAClD,OAAO,KAAK,eAAe,MAAM,oBAAoB,CAAC;AACtD,OAAO,KAAK,EAAE,aAAa,EAAE,cAAc,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AAE5F,OAAO,UAAU,MAAM,0BAA0B,CAAC;AAElD;;;GAGG;AACH,MAAM,CAAC,OAAO,OAAO,WAAW;IAC9B;;OAEG;IACH,OAAc,WAAW,EAAE,UAAU,CAAC,cAAc,CAAC,CAAoC;IAEzF;;OAEG;IACH,OAAc,kBAAkB,EAAE,UAAU,CAAC,qBAAqB,CAAC,CACzB;IAE1C,OAAO,CAAC,MAAM,CAAC,cAAc,CAA4C;IACzE,OAAO,CAAC,MAAM,CAAC,qBAAqB,CAAkB;IAEtD;;;;OAIG;WACW,WAAW,CAAC,MAAM,EAAE,aAAa,GAAG,IAAI;IAOtD;;;;;;;;;;;;;QAaI;WACU,QAAQ,CAAC,MAAM,EAAE,UAAU,EAAE,KAAK,EAAE,KAAK,EAAE,SAAS,CAAC,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI;IAKvG;;;;;;;;;OASG;WACW,YAAY,CAAC,IAAI,EAAE,aAAa,GAAG,IAAI;IAMrD;;;;;;;;;;;QAWI;WACU,UAAU,CAAC,MAAM,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI;IAKvF;;;;;;;;;;;OAWG;WACW,cAAc,CAAC,IAAI,EAAE,eAAe,GAAG,IAAI;IAKzD;;;;;QAKI;WACU,oBAAoB,CAChC,MAAM,EAAE,UAAU,EAClB,QAAQ,EAAE,SAAS,EACnB,SAAS,CAAC,EAAE,MAAM,EAClB,UAAU,CAAC,EAAE,MAAM,GAClB,IAAI;IAMP;;;;;;OAMG;IACH,WAAkB,oBAAoB,IAAI,OAAO,CAEhD;IAED,WAAkB,oBAAoB,CAAC,WAAW,EAAE,OAAO,EAS1D;WASa,sBAAsB,CAAC,MAAM,EAAE,UAAU,EAAE,QAAQ,EAAE,SAAS,EAAE,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI;IAKvG,OAAO,CAAC,MAAM,CAAC,IAAI;IA2BnB,OAAO,CAAC,MAAM,CAAC,eAAe;IAY9B,OAAO,CAAC,MAAM,CAAC,eAAe;CAgB/B"}