Socket
Socket
Sign inDemoInstall

@microsoft/sp-diagnostics

Package Overview
Dependencies
Maintainers
2
Versions
82
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@microsoft/sp-diagnostics - npm Package Compare versions

Comparing version 1.9.1 to 1.10.0-plusbeta

93

CHANGELOG.json

@@ -5,42 +5,12 @@ {

{
"version": "1.9.1",
"tag": "@microsoft/sp-diagnostics_v1.9.1",
"date": "Wed, 14 Aug 2019 06:49:49 GMT",
"version": "1.10.0",
"tag": "@microsoft/sp-diagnostics_v1.10.0",
"date": "Mon, 06 Jan 2020 18:14:53 GMT",
"comments": {
"dependency": [
{
"comment": "Updating dependency \"@ms/sp-build-internal-web\" from `~0.27.9` to `~0.27.10`"
}
]
}
},
{
"version": "1.9.0",
"tag": "@microsoft/sp-diagnostics_v1.9.0",
"date": "Mon, 22 Jul 2019 19:07:47 GMT",
"comments": {
"none": [
{
"comment": "Upgrade Typescript to 2.7.2"
"comment": "We skip sending the \"end\" event if we're debugging. We should also skip sending the \"start\" event. "
},
{
"comment": "Upgrade Typescript to 2.7.2"
},
{
"comment": "Fix the parameter order on trace logging."
},
{
"comment": "Upgrate TypeScript to 3.3"
},
{
"comment": "Adding \"Space\" as an option to _CurrentPage"
},
{
"comment": "api extractor config changes"
},
{
"comment": "Log CorrelationId"
},
{
"comment": "add correlationId"
"comment": "update @types/jest to match current jest version"
}

@@ -50,59 +20,8 @@ ],

{
"comment": "Updating dependency \"@ms/sp-build-internal-web\" from `~0.27.5` to `~0.27.6`"
"comment": "Updating dependency \"@ms/sp-build-internal-web\" from `~0.29.23` to `~0.29.24`"
}
]
}
},
{
"version": "1.7.0",
"tag": "@microsoft/sp-diagnostics_v1.7.0",
"date": "Thu, 08 Nov 2018 17:05:51 GMT",
"comments": {
"none": [],
"dependency": [
{
"comment": "Updating dependency \"@ms/sp-build-internal-web\" from `~0.22.12` to `~0.22.13`"
}
]
}
},
{
"version": "1.6.0",
"tag": "@microsoft/sp-diagnostics_v1.6.0",
"date": "Mon, 27 Aug 2018 18:06:28 GMT",
"comments": {
"dependency": [
{
"comment": "Updating dependency \"@ms/sp-build-internal-web\" from `~0.21.7` to `~0.21.8`"
}
]
}
},
{
"version": "1.5.1",
"tag": "@microsoft/sp-diagnostics_v1.5.1",
"date": "Tue, 26 Jun 2018 14:50:55 GMT",
"comments": {
"none": [],
"dependency": [
{
"comment": "Updating dependency \"@ms/sp-build-internal-web\" from `~0.16.15` to `~0.16.16`"
}
]
}
},
{
"version": "1.5.0",
"tag": "@microsoft/sp-diagnostics_v1.5.0",
"date": "Fri, 01 Jun 2018 18:13:37 GMT",
"comments": {
"none": [],
"dependency": [
{
"comment": "Updating dependency \"@ms/sp-build-internal-web\" from `~0.16.12` to `~0.16.13`"
}
]
}
}
]
}
# Change Log - @microsoft/sp-diagnostics
This log was last generated on Wed, 14 Aug 2019 06:49:49 GMT and should not be manually modified.
This log was last generated on Mon, 06 Jan 2020 18:14:53 GMT and should not be manually modified.
## 1.9.1
Wed, 14 Aug 2019 06:49:49 GMT
## 1.10.0
Mon, 06 Jan 2020 18:14:53 GMT
*Version update only*
## 1.9.0
Mon, 22 Jul 2019 19:07:47 GMT
### Updates
- Upgrade Typescript to 2.7.2
- Upgrade Typescript to 2.7.2
- Fix the parameter order on trace logging.
- Upgrate TypeScript to 3.3
- Adding "Space" as an option to _CurrentPage
- api extractor config changes
- Log CorrelationId
- add correlationId
- We skip sending the "end" event if we're debugging. We should also skip sending the "start" event.
- update @types/jest to match current jest version
## 1.7.0
Thu, 08 Nov 2018 17:05:51 GMT
### Updates
## 1.6.0
Mon, 27 Aug 2018 18:06:28 GMT
*Version update only*
## 1.5.1
Tue, 26 Jun 2018 14:50:55 GMT
### Updates
## 1.5.0
Fri, 01 Jun 2018 18:13:37 GMT
### Updates

14

dist/78359e4b-07c2-43c6-8d0b-d060b4d577e8.manifest.json

@@ -6,3 +6,3 @@ {

"componentType": "Library",
"version": "1.9.1",
"version": "1.10.0",
"loaderConfig": {

@@ -18,11 +18,11 @@ "entryModuleId": "sp-diagnostics",

},
"@microsoft/sp-lodash-subset": {
"type": "component",
"version": "1.10.0",
"id": "73e1dc6c-8441-42cc-ad47-4bd3659f8a3a"
},
"@microsoft/sp-core-library": {
"type": "component",
"version": "1.9.1",
"version": "1.10.0",
"id": "7263c7d0-1d6a-45ec-8d85-d4d1d234171b"
},
"@microsoft/sp-lodash-subset": {
"type": "component",
"version": "1.9.1",
"id": "73e1dc6c-8441-42cc-ad47-4bd3659f8a3a"
}

@@ -29,0 +29,0 @@ }

@@ -8,5 +8,5 @@ // This file is read by tools that parse documentation comments conforming to the TSDoc standard.

"packageName": "@microsoft/api-extractor",
"packageVersion": "7.1.8"
"packageVersion": "7.5.0"
}
]
}

@@ -1,4 +0,10 @@

var DefaultEngagementHandler = (function () {
/**
* Default implementation for the EngagementLogger class.
*/
var DefaultEngagementHandler = /** @class */ (function () {
function DefaultEngagementHandler() {
}
/**
* Default implementation for logData function.
*/
DefaultEngagementHandler.prototype.logData = function (data) {

@@ -10,1 +16,2 @@ console.log("TagName: " + data.name + ", Action Name: " + data.extraData);

export default DefaultEngagementHandler;
//# sourceMappingURL=DefaultEngagementHandler.js.map

@@ -1,4 +0,10 @@

var DefaultEngagementImplementation = (function () {
/**
* Default implementation for the EngagementLogger class.
*/
var DefaultEngagementImplementation = /** @class */ (function () {
function DefaultEngagementImplementation() {
}
/**
* Default implementation for logData function.
*/
DefaultEngagementImplementation.prototype.logData = function (data) {

@@ -10,1 +16,2 @@ console.log(data.name, data.extraData);

export default DefaultEngagementImplementation;
//# sourceMappingURL=DefaultEngagementImplementation.js.map

@@ -0,6 +1,21 @@

/**
* @copyright Microsoft Corporation.All rights reserved.
* @file EngagementLogger.ts
* EngagementLogger logger
*/
import LogManager from '../LogManager/LogManager';
import DiagnosticsSettingsManager from '../../DiagnosticsSettingsManager';
var EngagementLogger = (function () {
/**
* Engagement logging
* use *.Click for all the actions triggered by mouse, keyboard, or touch.
* if you want to add more data or the action is not click but keydown.
* Use extraData to log the type of action or use extraData to log details wrapped in LogEntry
* @internal
*/
var EngagementLogger = /** @class */ (function () {
function EngagementLogger() {
}
/**
* Init function for the passed logger object
*/
EngagementLogger._addHandler = function (logger) {

@@ -10,2 +25,5 @@ EngagementLogger._handler = function (e) { logger.logData(e); };

};
/**
* Starts processing logs in real time
*/
EngagementLogger.startRealTimeProcessing = function () {

@@ -17,5 +35,34 @@ if (!this._shouldProcessInRealTime) {

};
/**
* Engagement logging
*
* @remarks
* Use *.Click for all the actions triggered by mouse, keyboard, or touch.
* tagName follows `<Workload>.controlName.actionName` pattern
* For example, `{ name = "AddButton.Click" }`,
* this logs `"<Workload>.AddButton.Click"` with default action triggered by mouse, keyboard, or touch.
* `<Workload>` is set in Telemetry settings
* `IEngagementData` interface is mapped to a set of enums for standardization of mapping.
* Add new items to enum in order to register a new item specification.
* SiteType is defined in SiteType enum
* CurrentPage is defined in CurrentPage enum
* Component is defined in Component enum
* Feature is defined in Feature enum.
*/
EngagementLogger.log = function (engagementData) {
EngagementLogger._logEngagementData(engagementData);
};
/**
* Engagement logging
*
* @remarks
* Use *.Click for all the actions triggered by mouse, keyboard, or touch.
* tagName follows `<Workload>.controlName.actionName` pattern
* For example, `tagName = "AddButton.Click"`,
* this logs `"<Workload>.AddButton.Click"` with default action triggered by mouse, keyboard, or touch.
* `<Workload>` is set in Telemetry settings
* Use extraData to log the type of action.
* For example, `actionName = "Keydown"` and `tagName = "ModernPublish.AddButton.Click"`
* this logs `"<Workload>.AddButton.Click"` with the extraData that it was selected using the Keydown
*/
EngagementLogger.logEvent = function (tagName, actionName) {

@@ -28,4 +75,21 @@ var logData = { name: tagName };

};
/**
* Engagement logging with LogEntry
*
* @remarks
* Here is an example:
* ```
* {"EngagementName":"SPPage.NavigationAction.SPPageQuickLaunchUpdate"`,
* "Properties":"{\"message\":\"[NavigationAction] | SPPageQuickLaunchUpdate | 2 | null\"}",
* "Duration":0,"LogType":0,
* "ClientTime":1459357627444,"Source":"ClientV2Engagement"}
* ```
*
* NavigationAction is moduleName in LogEntry, SPPageQuickLaunchUpdate is log feature name
* In this example, SPPage is workload name which is set in Telemetry settings.
* Do NOT add PII data!
*/
EngagementLogger.logEventWithLogEntry = function (logEntry) {
var logData = {
isIntentional: logEntry.isIntentional,
name: logEntry.moduleName + '.' + logEntry.logFeature,

@@ -45,2 +109,3 @@ extraData: logEntry.logProperties

};
// tagName should follow AppName.ControlName.ActionName pattern
EngagementLogger._checkValidTagName = function (engagementData, isLogEntry) {

@@ -72,1 +137,2 @@ if (isLogEntry === void 0) { isLogEntry = false; }

export default EngagementLogger;
//# sourceMappingURL=EngagementLogger.js.map

@@ -123,2 +123,3 @@ /**

NewsPinnedItemSorted = "NewsPinnedItemSorted",
NewsSocialAction = "NewsSocialAction",
SelectNewsToPin = "SelectNewsToPin",

@@ -156,3 +157,4 @@ CreateNewsLinkFromHome = "CreateNewsLinkFromHome",

CheckedOutButton = "CheckedOutButton",
BaseWPSelectedLayout = "BaseWPSelectedLayout"
BaseWPSelectedLayout = "BaseWPSelectedLayout",
NewsRollup = "NewsRollup"
}

@@ -159,0 +161,0 @@ /**

@@ -1,11 +0,29 @@

var ExecutionQueue = (function () {
/**
* @copyright Microsoft Corporation. All rights reserved.
*/
/**
* ExecutionQueue allows multiple handlers to be processed in real time or deferred.
* @internal
*/
var ExecutionQueue = /** @class */ (function () {
function ExecutionQueue() {
this._shouldExecuteInRealTime = false;
this._handlers = {};
this._handlers = {}; // tslint:disable-line:typedef
this._executionEntries = [];
}
Object.defineProperty(ExecutionQueue.prototype, "shouldExecuteInRealTime", {
/**
* Determines if the added execution entries should be processed in real time.
* If this is set to true, a stack with entries will not be saved.
*/
get: function () {
return this._shouldExecuteInRealTime;
},
/**
* Sets the behavior for this execution stack.
* When set to true, all entries on stack will be processed and future entries
* will be executed in real time.
* When set to false, future entries will be saved in the execution stack for
* later processing.
*/
set: function (executeInRealTime) {

@@ -20,2 +38,6 @@ this._shouldExecuteInRealTime = executeInRealTime;

});
/**
* Registers an external handler to collection for delayed asyncronous processing.
* Handlers are registered once. If handler is already registered, it does nothing.
*/
ExecutionQueue.prototype.addHandler = function (key, handler) {

@@ -26,3 +48,3 @@ if (this._containsHandler(key, handler)) {

this._initializeHandlerArrayForKey(key);
var handlers = this._handlers[key];
var handlers = this._handlers[key]; // tslint:disable-line:no-any
if (handlers.indexOf(handler) === -1) {

@@ -32,2 +54,5 @@ handlers.push(handler);

};
/**
* Execution Entry registration for delayed asyncronous processing.
*/
ExecutionQueue.prototype.addExecutionEntry = function (key) {

@@ -46,2 +71,6 @@ var args = [];

};
/**
* Removes an external executionEntry handler from collection for asyncronous event logging.
* Logger is registered once.
*/
ExecutionQueue.prototype.removeHandler = function (key, handler) {

@@ -53,2 +82,6 @@ var index = this._handlers[key].indexOf(handler);

};
/**
* Reset function clears executionEntry handler collection for asyncronous event logging.
* All recorded execution entries and handlers are purged.
*/
ExecutionQueue.prototype.reset = function () {

@@ -58,2 +91,6 @@ this._handlers = {};

};
/**
* Flushes all the buffered execution entries.
* All recorded execution entries are purged.
*/
ExecutionQueue.prototype.flush = function () {

@@ -102,1 +139,2 @@ this._processAllExecutionEntries();

export default ExecutionQueue;
//# sourceMappingURL=ExecutionQueue.js.map

@@ -12,2 +12,6 @@ /**

/**
* Optionally log if the event indicates an intentional action or not
*/
isIntentional?: boolean;
/**
* The name of the module associated with this entry

@@ -14,0 +18,0 @@ */

@@ -0,4 +1,11 @@

/**
* @copyright Microsoft Corporation. All rights reserved.
*/
import { LogLevel } from '../LogLevel';
import LogEvent from '../Trace/LogEvent';
var LogHandler = (function () {
/**
* This handler adapts the sp-core-library Log to use the internal telemetry.
* @internal
*/
var LogHandler = /** @class */ (function () {
function LogHandler() {

@@ -9,3 +16,3 @@ }

if (DEBUG && !DEPRECATED_UNIT_TEST) {
console.log(event.toString());
console.log(event.toString()); // tslint:disable-line:no-console
}

@@ -16,3 +23,3 @@ };

if (DEBUG && !DEPRECATED_UNIT_TEST) {
console.info(event.toString());
console.info(event.toString()); // tslint:disable-line:no-console
}

@@ -23,3 +30,3 @@ };

if (DEBUG && !DEPRECATED_UNIT_TEST) {
console.warn(event.toString());
console.warn(event.toString()); // tslint:disable-line:no-console
}

@@ -30,3 +37,3 @@ };

if (DEBUG && !DEPRECATED_UNIT_TEST) {
console.error(event.toString());
console.error(event.toString()); // tslint:disable-line:no-console
}

@@ -37,1 +44,2 @@ };

export default LogHandler;
//# sourceMappingURL=LogHandler.js.map

@@ -15,2 +15,3 @@ import ILogEntry from './ILogEntry';

};
isIntentional: boolean;
/**

@@ -25,3 +26,3 @@ * Initializes a new instance of LogEntry

[key: string]: string;
});
}, isIntentional?: boolean);
/**

@@ -28,0 +29,0 @@ * convert the log entry to string

@@ -0,5 +1,18 @@

// Copyright (c) Microsoft. All rights reserved.
import LogFeature from './LogFeature';
import LogType from './LogType';
var LogEntry = (function () {
function LogEntry(moduleName, logFeature, logType, logProperties) {
/**
* Represents a Log entry
*
* @internal
*/
var LogEntry = /** @class */ (function () {
/**
* Initializes a new instance of LogEntry
* @param moduleName - the name of the module
* @param logFeature - the name of the feature
* @param logType - the log type
* @param logProperties - optional property bag
*/
function LogEntry(moduleName, logFeature, logType, logProperties, isIntentional) {
if (logFeature === void 0) { logFeature = LogFeature.None; }

@@ -12,2 +25,3 @@ if (logType === void 0) { logType = LogType.Trace; }

this.logProperties = logProperties;
this.isIntentional = isIntentional;
}

@@ -18,2 +32,6 @@ else {

}
/**
* convert the log entry to string
* @returns the serialized log entry
*/
LogEntry.prototype.toString = function () {

@@ -34,1 +52,2 @@ var serializedLogProps = undefined;

export default LogEntry;
//# sourceMappingURL=LogEntry.js.map

@@ -1,4 +0,13 @@

var LogFeature = (function () {
/**
* @file LogFeature.ts
* @Copyright (c) Microsoft Corporation. All rights reserved.
* Used for logging so you can filter logs by features.
*/
/**
* @internal
*/
var LogFeature = /** @class */ (function () {
function LogFeature() {
}
/* tslint:disable:variable-name */
LogFeature.None = 'None';

@@ -8,1 +17,2 @@ return LogFeature;

export default LogFeature;
//# sourceMappingURL=LogFeature.js.map

@@ -0,7 +1,27 @@

/**
* @copyright Microsoft Corporation. All rights reserved.
*/
/**
* LogLevel represents the level of a log event.
* @internal
*/
export var LogLevel;
(function (LogLevel) {
/**
* verbose event for debugging
*/
LogLevel[LogLevel["Verbose"] = 1] = "Verbose";
/**
* Informational event
*/
LogLevel[LogLevel["Info"] = 2] = "Info";
/**
* A warning
*/
LogLevel[LogLevel["Warning"] = 3] = "Warning";
/**
* An error
*/
LogLevel[LogLevel["Error"] = 4] = "Error";
})(LogLevel || (LogLevel = {}));
//# sourceMappingURL=LogLevel.js.map

@@ -1,4 +0,16 @@

var CircularBuffer = (function () {
/**
* @copyright Microsoft Corporation. All rights reserved.
*/
/**
* @internal
*/
var CircularBuffer = /** @class */ (function () {
function CircularBuffer(size) {
/**
* Index of the newest item in the buffer
*/
this._head = -1;
/**
* The overall count of how many items have ever been added to the buffer.
*/
this._count = 0;

@@ -35,5 +47,7 @@ this._isIterating = false;

var current = this._tail;
// For-loop is prefered over while loop here to avoid possible infinite loop.
for (var i = 0; i < this._size; i++) {
handle(this._buffer[current]);
if (current === this._head) {
// The newest item has been processed. End the loop.
break;

@@ -54,2 +68,5 @@ }

Object.defineProperty(CircularBuffer.prototype, "_tail", {
/**
* Index of the oldest item in the buffer
*/
get: function () {

@@ -67,2 +84,6 @@ if (this._isNotWrapped()) {

};
/**
* The next index should be index + 1, unless it reaches
* the end of the buffer and needs to rewind to 0.
*/
CircularBuffer.prototype._getNext = function (index) {

@@ -83,1 +104,2 @@ var nextIndex = index + 1;

export default CircularBuffer;
//# sourceMappingURL=CircularBuffer.js.map

@@ -0,3 +1,13 @@

/**
* @copyright Microsoft Corporation. All rights reserved.
*/
import CircularBuffer from './CircularBuffer';
var LogManager = (function () {
/**
* LogManager allows multiple handlers to process log events.
* It caches the latest 5000 log events. If a handler is just added, the
* handler is able to get access to the cached events and all incoming events.
* Dev-dashboard and potentially third-party can use it to get access to events.
* @internal
*/
var LogManager = /** @class */ (function () {
function LogManager(initialHandler) {

@@ -19,2 +29,6 @@ this._shouldLogInRealTime = [];

Object.defineProperty(LogManager.prototype, "events", {
/**
* Event list for delayed asynchronous processing.
* Events are accumulated in CircularBuffer for processing later.
*/
get: function () {

@@ -26,2 +40,6 @@ return this._events;

});
/**
* Registers an external logger to logger collection for asynchronous event logging.
* Logger is registered once.
*/
LogManager.prototype.addHandler = function (handler) {

@@ -33,2 +51,5 @@ if (!this._containsHandler(handler)) {

};
/**
* Event logging operation for delayed asynchronous processing.
*/
LogManager.prototype.log = function (event) {

@@ -39,2 +60,6 @@ Object.freeze(event);

};
/**
* Removes an external logger from logger collection for asynchronous event logging.
* Logger is registered once.
*/
LogManager.prototype.removeHandler = function (handler) {

@@ -47,2 +72,6 @@ var index = this._handlers.indexOf(handler);

};
/**
* Reset function clears logger collection for asynchronous event logging.
* All recorded events are purged.
*/
LogManager.prototype.reset = function () {

@@ -53,2 +82,5 @@ this._handlers = [];

};
/**
* Processes all the buffered events using the registered handler.
*/
LogManager.prototype.processAll = function (handler) {

@@ -96,1 +128,2 @@ if (this._handlers.indexOf(handler) > -1) {

export default LogManager;
//# sourceMappingURL=LogManager.js.map

@@ -0,3 +1,9 @@

// Copyright (c) Microsoft. All rights reserved.
import { ServiceKey, Validate } from '@microsoft/sp-core-library';
var LogSource = (function () {
/**
* Represents a Log entry
*
* @internal
*/
var LogSource = /** @class */ (function () {
function LogSource(id) {

@@ -7,2 +13,6 @@ Validate.isNotNullOrUndefined(id, 'id');

}
/**
* Factory method to create an instance of the LogSource class
* @returns a reference to an instance of the LogSource class
*/
LogSource.create = function (id) {

@@ -18,2 +28,5 @@ return new LogSource(id);

});
/**
* @returns if the LogSource is empty.
*/
LogSource.prototype.isEmpty = function () {

@@ -25,4 +38,6 @@ return this._id.length === 0;

export default LogSource;
/** @public */
export var logSourceServiceKey = ServiceKey.createCustom('sp-client-base:LogSource', function (serviceScope) {
return LogSource.create('');
});
//# sourceMappingURL=LogSource.js.map

@@ -0,7 +1,23 @@

// Copyright (c) Microsoft. All rights reserved.
/**
* Represents the supported log types
*
* @internal
*/
var LogType;
(function (LogType) {
/**
* Trace level log. Use this for logging diagnostics
*/
LogType[LogType["Trace"] = 1] = "Trace";
/**
* Event level log. Use this for logging usage etc
*/
LogType[LogType["Event"] = 2] = "Event";
/**
* Use for errors
*/
LogType[LogType["Error"] = 3] = "Error";
})(LogType || (LogType = {}));
export default LogType;
//# sourceMappingURL=LogType.js.map

@@ -0,3 +1,10 @@

/**
* @copyright Microsoft Corporation. All rights reserved.
*/
import ExecutionQueue from '../ExecutionQueue';
var QosLogger = (function () {
/**
* QosLogger allows multiple QosMonitors to be deferred processed.
* @internal
*/
var QosLogger = /** @class */ (function () {
function QosLogger() {

@@ -46,3 +53,3 @@ this._qosEvents = new Map();

if (this._qosLogger) {
this._qosEvents.set(key, new this._qosLogger(event));
this._qosEvents.set(key, new this._qosLogger(event)); /* tslint:disable-line:no-any */
}

@@ -52,10 +59,11 @@ };

if (this._qosEvents.has(key)) {
this._qosEvents.get(key).end(event);
this._qosEvents.get(key).end(event); /* tslint:disable-line:no-any */
this._qosEvents.delete(key);
}
};
/* tslint:disable-next-line:no-any typedef */
QosLogger.prototype.initializeLogger = function () {
var _this = this;
var startHandler = function (key, e) { _this._startMonitor(key, e); };
var endHandler = function (key, e) { _this._endMonitor(key, e); };
var startHandler = function (key, e) { _this._startMonitor(key, e); }; /* tslint:disable-line:max-line-length typedef */
var endHandler = function (key, e) { _this._endMonitor(key, e); }; /* tslint:disable-line:max-line-length typedef */
this._deferExecutor.addHandler('start', startHandler);

@@ -67,1 +75,2 @@ this._deferExecutor.addHandler('end', endHandler);

export default QosLogger;
//# sourceMappingURL=QosLogger.js.map

@@ -11,2 +11,3 @@ import { QosResultType } from './QosResultType';

private static readonly qosMonitorHasEndedErrorString;
private static _isExtraDataSetterEnabledKSId;
private _id;

@@ -37,3 +38,3 @@ private _hasEnded;

readonly resultType: QosResultType;
readonly extraData: any;
extraData: any;
readonly hasEnded: boolean;

@@ -59,3 +60,3 @@ /**

private _writeQosEnd;
private _isLogCorrelationIdKillSwitchActive;
private _isDebugSession;
private _shouldSkip;

@@ -62,0 +63,0 @@ private _writeToEngagement;

@@ -1,2 +0,3 @@

import { Text, Guid, _SPKillSwitch, Validate } from '@microsoft/sp-core-library';
// Copyright (c) Microsoft. All rights reserved.
import { _SPKillSwitch, Guid, Text, Validate } from '@microsoft/sp-core-library';
import TraceLogger from '../Trace/TraceLogger';

@@ -6,3 +7,15 @@ import QosLogger from './QosLogger';

import DiagnosticsSettingsManager from '../../DiagnosticsSettingsManager';
var QosMonitor = (function () {
/**
* Qos logger
* This class represents the Qos monitor APIs
*
* @preapproved @internal
*/
var QosMonitor = /** @class */ (function () {
/**
* Creates a QoS monitor (initializes it and logs the start event)
* @param scenarioName - Unique name of the QoS scenario
* You will see start tag: SPPages.ScenarioName.Start
* @param copyToEngagement - indicate whether this data should be used as Engagement as well.
*/
function QosMonitor(scenarioName, copyToEngagement) {

@@ -12,9 +25,12 @@ var _a;

this._qosResultTypeValue = (_a = {},
_a[0 ] = 'Success',
_a[1 ] = 'Failure',
_a[2 ] = 'ExpectedFailure',
_a[0 /* Success */] = 'Success',
_a[1 /* Failure */] = 'Failure',
_a[2 /* ExpectedFailure */] = 'ExpectedFailure',
_a);
Validate.isNonemptyString(scenarioName, 'scenarioName');
this._id = Guid.newGuid().toString();
QosLogger.instance.startQosMonitor(this._id, { name: scenarioName });
if (!this._isDebugSession() ||
_SPKillSwitch.isActivated(Guid.parse('2f038457-f3a3-40d4-8eb1-c9b4495f2419'), '10/15/2019', 'WEX_SkipNonShipQoSUploadStartEvents')) {
QosLogger.instance.startQosMonitor(this._id, { name: scenarioName });
}
this._scenarioName = scenarioName;

@@ -29,2 +45,6 @@ this._hasEnded = false;

};
/**
* Only used in unit tests
* @internal
*/
QosMonitor._shouldProcessInRealTime = function (processInRealTime) {

@@ -56,2 +76,3 @@ QosLogger.instance.shouldProcessInRealTime = processInRealTime;

get: function () {
/* tslint:disable-next-line:no-any */
return this._endResult;

@@ -66,2 +87,5 @@ },

},
set: function (value) {
this._endExtraData = value;
},
enumerable: true,

@@ -77,22 +101,39 @@ configurable: true

});
/**
* QoS monitor ends with success
* You will see success tag: SPPages.ScenarioName.Success
*/
QosMonitor.prototype.writeSuccess = function (extraData) {
this._writeQosEnd(0 , undefined, undefined, extraData);
this._writeQosEnd(0 /* Success */, undefined, undefined, extraData);
};
/**
* QoS monitor ends with failure
* You will see failure tag: SPPages.ScenarioName.<failuretag>.Failure.
* <failuretag> will be filled with param tagName
*/
QosMonitor.prototype.writeUnexpectedFailure = function (tagNameSuffix, ex, extraData) {
if (tagNameSuffix === void 0) { tagNameSuffix = 'DefaultUnexpected'; }
this._writeQosEnd(1 , tagNameSuffix, ex, extraData);
this._writeQosEnd(1 /* Failure */, tagNameSuffix, ex, extraData);
};
/*
* QoS monitor ends with expected failure
* You will see success tag: ModernPublish.RenderPublishPage.<failuretag>.ExpectedFailure.
* <failuretag> will be filled with param tagName
*/
QosMonitor.prototype.writeExpectedFailure = function (tagNameSuffix, ex, extraData) {
if (tagNameSuffix === void 0) { tagNameSuffix = 'DefaultExpected'; }
this._writeQosEnd(2 , tagNameSuffix, ex, extraData);
this._writeQosEnd(2 /* ExpectedFailure */, tagNameSuffix, ex, extraData);
};
QosMonitor.prototype._writeQosEnd = function (resultType, tagNameSuffix, ex, extraData) {
if (!this._shouldSkip(resultType)) {
if (!this._isLogCorrelationIdKillSwitchActive() &&
DiagnosticsSettingsManager.isInitialized &&
resultType !== 0 ) {
var enableExtraDataSetter = !_SPKillSwitch.isActivated(QosMonitor._isExtraDataSetterEnabledKSId, '9/11/2019', 'WPLoadExtraData');
/* tslint:disable-next-line:no-any */
var existingExtraData = enableExtraDataSetter ? this.extraData : undefined;
if (DiagnosticsSettingsManager.isInitialized &&
resultType !== 0 /* Success */) {
var correlationId = DiagnosticsSettingsManager.settings.correlationId;
if (!extraData) {
extraData = {};
extraData = existingExtraData || {};
}
// Reuse the existing CorrelationId column for extraData
extraData.CorrelationId = extraData.correlationId ||

@@ -103,3 +144,3 @@ extraData.CorrelationId ||

this._endResultCode = tagNameSuffix;
this._endExtraData = extraData;
this._endExtraData = extraData || existingExtraData;
this._endResult = resultType;

@@ -116,4 +157,4 @@ var endData = {

};
QosMonitor.prototype._isLogCorrelationIdKillSwitchActive = function () {
return _SPKillSwitch.isActivated(Guid.parse('e599b604-cf86-4274-a9c9-172adc97e1d2'), '5/22/2019', 'Log correlation Id if not specified already');
QosMonitor.prototype._isDebugSession = function () {
return !!sessionStorage.getItem('spfx-debug');
};

@@ -133,3 +174,3 @@ QosMonitor.prototype._shouldSkip = function (result) {

this._hasEnded = true;
return false;
return this._isDebugSession();
}

@@ -139,2 +180,4 @@ };

if (this._shouldWriteToEngagement()) {
// Engagement name requires certain format. Cannot just use QOS name.
// Record Qos name in extra data 'qosName'
var engagementData = {

@@ -144,7 +187,10 @@ name: 'Spfx.Qos.ToEngagement',

};
// tslint:disable-next-line:no-string-literal
engagementData.extraData['qosName'] = this.name;
if (this.resultType) {
// tslint:disable-next-line:no-string-literal
engagementData.extraData['qosResultType'] = this._qosResultTypeValue[this.resultType];
}
if (this.resultCode) {
// tslint:disable-next-line:no-string-literal
engagementData.extraData['qosResultCode'] = this.resultCode;

@@ -163,4 +209,6 @@ }

QosMonitor.qosMonitorHasEndedErrorString = 'QoS monitor \'{0}\' has ended with \'{1}\' already. Ignoring \'{2}\' tag.';
QosMonitor._isExtraDataSetterEnabledKSId = Guid.parse('6d18e32c-abd5-40c1-8ce1-3fb551418901');
return QosMonitor;
}());
export default QosMonitor;
//# sourceMappingURL=QosMonitor.js.map

@@ -1,4 +0,14 @@

var DefaultTraceHandler = (function () {
/**
* @copyright Microsoft Corporation.All rights reserved.
* @file DefaultTraceHandler.ts
*/
/**
* Default implementation for the Trace logger class.
*/
var DefaultTraceHandler = /** @class */ (function () {
function DefaultTraceHandler() {
}
/**
* Default implementation for log function.
*/
DefaultTraceHandler.prototype.log = function (traceLogEvent) {

@@ -11,2 +21,5 @@ if (!DEPRECATED_UNIT_TEST) {

};
/**
* Default implementation for verbose function.
*/
DefaultTraceHandler.prototype.verbose = function (verboseTraceEvent) {

@@ -20,1 +33,2 @@ if (!DEPRECATED_UNIT_TEST) {

export default DefaultTraceHandler;
//# sourceMappingURL=DefaultTraceHandler.js.map
import { logSourceServiceKey } from '../LogSource';
import LogManager from '../LogManager/LogManager';
var LogEvent = (function () {
/**
* An object that represents one log event.
* @internal
*/
var LogEvent = /** @class */ (function () {
/**
* Do not call this constructor directly. Use LogEvent.log instead.
*/
function LogEvent(source, data, level, serviceScope) {

@@ -13,2 +20,10 @@ this._validate(source, data);

}
/**
* Use this method to log an event.
*
* @param source - source of the log event, e.g. class name of the source file
* @param data - data of the log event
* @param level - level of the log event
* @param serviceScope - scope of the log event, e.g. component/web part
*/
LogEvent.log = function (source, data, level, serviceScope) {

@@ -126,2 +141,5 @@ var event = new LogEvent(source, data, level, serviceScope);

};
/**
* Allows process log events.
*/
LogEvent.logManager = new LogManager();

@@ -131,1 +149,2 @@ return LogEvent;

export default LogEvent;
//# sourceMappingURL=LogEvent.js.map

@@ -6,5 +6,14 @@ import { Validate } from '@microsoft/sp-core-library';

import LogManager from './../LogManager/LogManager';
var TraceLogger = (function () {
/**
* This is used to log traces of failed operations and debugging information.
* @internal
*/
var TraceLogger = /** @class */ (function () {
function TraceLogger() {
}
/**
* Init function for the passed logger object
*
* @internal
*/
TraceLogger._addHandler = function (logger) {

@@ -16,2 +25,16 @@ TraceLogger._logManager.addHandler(logger.log);

};
/**
* Exception logging
* This shoule be used whenever you want to log something that might in future help to debug failures.
* The error parameter is the only required one and basically will be just converted to string and
* logged to Debug stream (RealibilityLogs in SLAPI).
* It will also be uploaded to the server immediately and not wait for next batch log upload.
* If you don't specify second parameter:eventName
* the event name for all errors logged that way will be same "CaughtError" with
* appropriate prefix ("ModernPublish.CaughtError" etc.)
* These two parameters "eventName and resultCode" are there to be used from Qos.
* It is not encouraged to use them directly from ErrorHelper but if you do,
* the log will be written with custom event name of following format:
* <Workload>.<eventName>.<resultCode>.Failure, Workload is set in Telemetry settings.
**/
TraceLogger.logError = function (source, error, eventName, resultCode) {

@@ -21,2 +44,12 @@ Validate.isNotNullOrUndefined(error, 'error');

};
/**
* Exception logging intended to replace to logError.
*
* @remarks
* Uses the `ILogErrorData` interface to prevent excessive undefined parameters
* when calling this function.
* This should be used whenever you want to log something that might in future help to
* debug failures.
* It will also be uploaded to the server immediately and not wait for next batch log upload.
*/
TraceLogger.logErrorData = function (data) {

@@ -27,2 +60,14 @@ Validate.isNotNullOrUndefined(data.error, 'error');

};
/**
* Trace logging
* The idea here is that verbose logs don't get uploaded to the server unless
* a failure is logged using ErrorHelper.log method.
* There is a circular buffer that holds last 50 verbose logs from all scenarios and
* it is only flushed and uploaded in case a failure is logged.
* That way whenever you get a failure event with message you also have all supportive verbose messages
* you logged throughout your scenario execution (or other scenarios).
* And hopefully that would help you get to the bottom of what exactly went wrong.
* If no failure happens and your scenario succeeds, verbose logs will be just left in the buffer
* and most likely overriden by next scenario that logs something verbose.
**/
TraceLogger.logVerbose = function (source, message, eventName) {

@@ -32,2 +77,14 @@ Validate.isNonemptyString(message, 'message');

};
/**
* Verbose logging intended to replace to logVerbose.
* The idea here is that verbose logs don't get uploaded to the server unless
* a failure is logged using ErrorHelper.log method.
* There is a circular buffer that holds last 50 verbose logs from all scenarios and
* it is only flushed and uploaded in case a failure is logged.
* That way whenever you get a failure event with message you also have all supportive verbose messages
* you logged throughout your scenario execution (or other scenarios).
* And hopefully that would help you get to the bottom of what exactly went wrong.
* If no failure happens and your scenario succeeds, verbose logs will be just left in the buffer
* and most likely overriden by next scenario that logs something verbose.
*/
TraceLogger.logVerboseData = function (data) {

@@ -37,2 +94,8 @@ var message = data.logEntry ? data.logEntry.toString() : data.message;

};
/**
* Exception logging With LogEntry
* error message should be packed into logProperties
* LogType should be LogType.Error and LogProperties should have `{error:errorMessage}`
* Do NOT add PII data!
**/
TraceLogger.logErrorWithLogEntry = function (source, logEntry, eventName, resultCode) {

@@ -44,3 +107,11 @@ Validate.isNotNullOrUndefined(source, 'source');

Object.defineProperty(TraceLogger, "shouldWriteToConsole", {
/**
* Indicates if the log entries should be output to the console.
* This flag is set to true by default.
*/
get: function () { return TraceLogger._shouldWriteToConsole; },
/**
* Toggles console output functionality.
* Property can be chaged by remote caller.
*/
set: function (shouldWrite) {

@@ -60,2 +131,9 @@ if (TraceLogger._shouldWriteToConsole && !shouldWrite) {

});
/*
* Trace logging with `LogEntry`
* The same with above other than wrapped log into `logEntry`
* Trace message should be packed into `logProperties`
* `LogType` should be `LogType.Trace` and LogProperties should have something like `{errors:errorMessage}`
* Do NOT add PII data!
**/
TraceLogger.logVerboseWithLogEntry = function (source, logEntry, eventName) {

@@ -80,2 +158,6 @@ Validate.isNotNullOrUndefined(logEntry, 'LogEntry');

};
/*
* EventName is:
* sourceId.eventName or sourceId if eventName is not provided.
*/
TraceLogger._addEventPrefix = function (source, eventName) {

@@ -89,3 +171,8 @@ if (!eventName) {

};
/*
* The log message in console is:
* `[eventName]: data`.
*/
TraceLogger._writeToConsole = function (logEvent, isError, resultCode) {
// @todo (SPPPLAT VSO#250083): This date should be a part of the logEvent.
var errorString = logEvent.toString();

@@ -95,2 +182,3 @@ if (resultCode) {

}
// Task 191596: only write to console when a condition is satisfied (e.g., a query parameter provided).
if (isError) {

@@ -103,3 +191,9 @@ console.error(errorString);

};
/**
* Allows process trace log events.
*/
TraceLogger._logManager = new LogManager();
/**
* Allows process verbose trace log events.
*/
TraceLogger._verboseLogManager = new LogManager();

@@ -111,1 +205,2 @@ TraceLogger._defaultLogger = new DefaultTraceHandler();

export default TraceLogger;
//# sourceMappingURL=TraceLogger.js.map

@@ -0,7 +1,21 @@

/**
* @copyright Microsoft Corporation. All rights reserved.
*/
import { Log } from '@microsoft/sp-core-library';
import DiagnosticsSettingsManager from './DiagnosticsSettingsManager';
import TraceLogger from './Api/Trace/TraceLogger';
var Diagnostics = (function () {
/**
* Diagnostics class initializes the diagnostics pipeline and connect to backend server.
* Diagnostics contains a set of internal APIs that collects data and reports data via
* the pipeline. The APIs consist of
* -- TraceLogger - for logging diagnostic information
*
* @internal
*/
var Diagnostics = /** @class */ (function () {
function Diagnostics() {
}
/**
* Initializes the diagnostics pipelines
*/
Diagnostics.initialize = function (settings) {

@@ -23,2 +37,5 @@ if (!Diagnostics._isInitialized) {

Object.defineProperty(Diagnostics, "isInitialized", {
/**
* Returns true if diagnostics has been already initialized.
*/
get: function () {

@@ -30,2 +47,7 @@ return this._isInitialized;

});
/**
* Used to refresh the telemetry settings when they change from the application
* (i.e. when an in-place navigation to a different site happens)
* @param settings - the subset of the telemetry settings to be updated
*/
Diagnostics.updateSettings = function (settings) {

@@ -38,1 +60,2 @@ DiagnosticsSettingsManager.updateSettings(settings);

export default Diagnostics;
//# sourceMappingURL=Diagnostics.js.map

@@ -19,4 +19,3 @@ /**

private static _normalizeContextIds;
private static isLogCorrelationIdKillSwitchActive;
}
//# sourceMappingURL=DiagnosticsSettingsManager.d.ts.map

@@ -1,4 +0,13 @@

import { Guid, _SPKillSwitch } from '@microsoft/sp-core-library';
/**
* @copyright Microsoft Corporation. All rights reserved.
*/
import { Guid } from '@microsoft/sp-core-library';
import { cloneDeep, merge } from '@microsoft/sp-lodash-subset';
var DiagnosticsSettingsManager = (function () {
/**
* TelemetrySettingsManager stores the configuration for Telemetry passed
* down by the calling application during bootstrapping.
*
* @internal
*/
var DiagnosticsSettingsManager = /** @class */ (function () {
function DiagnosticsSettingsManager() {

@@ -29,5 +38,3 @@ }

this.settings.webId = this._normalizeId(this.settings.webId);
if (!DiagnosticsSettingsManager.isLogCorrelationIdKillSwitchActive()) {
this.settings.correlationId = this._normalizeId(this.settings.correlationId);
}
this.settings.correlationId = this._normalizeId(this.settings.correlationId);
if (this.settings.listId) {

@@ -40,5 +47,2 @@ this.settings.listId = this._normalizeId(this.settings.listId);

};
DiagnosticsSettingsManager.isLogCorrelationIdKillSwitchActive = function () {
return _SPKillSwitch.isActivated(Guid.parse('d5a5b220-14a0-4f8f-b84e-d5e771a9e43e'), '3/26/2019', 'Log correlation Id if not specified already');
};
DiagnosticsSettingsManager._initialized = false;

@@ -48,1 +52,2 @@ return DiagnosticsSettingsManager;

export default DiagnosticsSettingsManager;
//# sourceMappingURL=DiagnosticsSettingsManager.js.map

@@ -0,1 +1,7 @@

/**
* This package defines the internal diagnostics tools for the SharePoint Framework,
* including monitoring, trace, user engagement and performance logging.
*
* @packagedocumentation
*/
export { default as _TraceLogger } from './Api/Trace/TraceLogger';

@@ -16,1 +22,2 @@ export { default as _LogEntry } from './Api/LogEntry';

export { default as _ExecutionQueue } from './Api/ExecutionQueue';
//# sourceMappingURL=index.js.map
{
"name": "@microsoft/sp-diagnostics",
"version": "1.9.1",
"version": "1.10.0-plusbeta",
"description": "Diagnostics tools for the SharePoint Framework",

@@ -13,14 +13,19 @@ "license": "SEE LICENSE IN \"EULA\" FOLDER",

"tslib": "~1.9.3",
"@types/jest": "21.1.10",
"@types/jest": "22.2.3",
"@types/webpack-env": "1.13.1",
"@ms/sp-build-compiler-3.3": "1.9.0-dev.4",
"@ms/sp-build-internal-web": "~0.27.10"
"@ms/sp-build-internal-web": "~0.29.24"
},
"dependencies": {
"@microsoft/sp-core-library": "1.9.1",
"@microsoft/sp-lodash-subset": "1.9.1"
"@microsoft/sp-core-library": "1.10.0-plusbeta",
"@microsoft/sp-lodash-subset": "1.10.0-plusbeta"
},
"scripts": {
"build": "gulp test --clean"
},
"quickbuild": {
"additionalInputs": [
"../../common/reviews/api/sp-diagnostics.api.md"
]
}
}

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc