Socket
Socket
Sign inDemoInstall

@pnp/logging

Package Overview
Dependencies
Maintainers
6
Versions
1046
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@pnp/logging - npm Package Compare versions

Comparing version 1.0.4-4 to 1.0.4

2

dist/logging.es5.js
/**
@license
* @pnp/logging v1.0.4-4 - pnp - light-weight, subscribable logging framework
* @pnp/logging v1.0.4 - pnp - light-weight, subscribable logging framework
* MIT (https://github.com/pnp/pnpjs/blob/master/LICENSE)

@@ -5,0 +5,0 @@ * Copyright (c) 2018 Microsoft

/**
@license
* @pnp/logging v1.0.4-4 - pnp - light-weight, subscribable logging framework
* @pnp/logging v1.0.4 - pnp - light-weight, subscribable logging framework
* MIT (https://github.com/pnp/pnpjs/blob/master/LICENSE)

@@ -5,0 +5,0 @@ * Copyright (c) 2018 Microsoft

/**
@license
* @pnp/logging v1.0.4-4 - pnp - light-weight, subscribable logging framework
* @pnp/logging v1.0.4 - pnp - light-weight, subscribable logging framework
* MIT (https://github.com/pnp/pnpjs/blob/master/LICENSE)

@@ -5,0 +5,0 @@ * Copyright (c) 2018 Microsoft

/**
@license
* @pnp/logging v1.0.4-4 - pnp - light-weight, subscribable logging framework
* @pnp/logging v1.0.4 - pnp - light-weight, subscribable logging framework
* MIT (https://github.com/pnp/pnpjs/blob/master/LICENSE)

@@ -11,211 +11,211 @@ * Copyright (c) 2018 Microsoft

(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
typeof define === 'function' && define.amd ? define(['exports'], factory) :
(factory((global.pnp = global.pnp || {}, global.pnp.logging = {})));
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
typeof define === 'function' && define.amd ? define(['exports'], factory) :
(factory((global.pnp = global.pnp || {}, global.pnp.logging = {})));
}(this, (function (exports) { 'use strict';
/**
* Class used to subscribe ILogListener and log messages throughout an application
*
*/
var Logger = /** @class */ (function () {
function Logger() {
}
Object.defineProperty(Logger, "activeLogLevel", {
/**
* Gets or sets the active log level to apply for log filtering
*/
get: function () {
return Logger.instance.activeLogLevel;
},
set: function (value) {
Logger.instance.activeLogLevel = value;
},
enumerable: true,
configurable: true
});
Object.defineProperty(Logger, "instance", {
get: function () {
if (typeof Logger._instance === "undefined" || Logger._instance === null) {
Logger._instance = new LoggerImpl();
}
return Logger._instance;
},
enumerable: true,
configurable: true
});
/**
* Adds ILogListener instances to the set of subscribed listeners
* Class used to subscribe ILogListener and log messages throughout an application
*
* @param listeners One or more listeners to subscribe to this log
*/
Logger.subscribe = function () {
var listeners = [];
for (var _i = 0; _i < arguments.length; _i++) {
listeners[_i] = arguments[_i];
var Logger = /** @class */ (function () {
function Logger() {
}
listeners.map(function (listener) { return Logger.instance.subscribe(listener); });
};
/**
* Clears the subscribers collection, returning the collection before modifiction
*/
Logger.clearSubscribers = function () {
return Logger.instance.clearSubscribers();
};
Object.defineProperty(Logger, "count", {
Object.defineProperty(Logger, "activeLogLevel", {
/**
* Gets or sets the active log level to apply for log filtering
*/
get: function () {
return Logger.instance.activeLogLevel;
},
set: function (value) {
Logger.instance.activeLogLevel = value;
},
enumerable: true,
configurable: true
});
Object.defineProperty(Logger, "instance", {
get: function () {
if (typeof Logger._instance === "undefined" || Logger._instance === null) {
Logger._instance = new LoggerImpl();
}
return Logger._instance;
},
enumerable: true,
configurable: true
});
/**
* Gets the current subscriber count
* Adds ILogListener instances to the set of subscribed listeners
*
* @param listeners One or more listeners to subscribe to this log
*/
get: function () {
return Logger.instance.count;
},
enumerable: true,
configurable: true
});
/**
* Writes the supplied string to the subscribed listeners
*
* @param message The message to write
* @param level [Optional] if supplied will be used as the level of the entry (Default: LogLevel.Verbose)
*/
Logger.write = function (message, level) {
if (level === void 0) { level = 0 /* Verbose */; }
Logger.instance.log({ level: level, message: message });
};
/**
* Writes the supplied string to the subscribed listeners
*
* @param json The json object to stringify and write
* @param level [Optional] if supplied will be used as the level of the entry (Default: LogLevel.Verbose)
*/
Logger.writeJSON = function (json, level) {
if (level === void 0) { level = 0 /* Verbose */; }
Logger.instance.log({ level: level, message: JSON.stringify(json) });
};
/**
* Logs the supplied entry to the subscribed listeners
*
* @param entry The message to log
*/
Logger.log = function (entry) {
Logger.instance.log(entry);
};
/**
* Logs an error object to the subscribed listeners
*
* @param err The error object
*/
Logger.error = function (err) {
Logger.instance.log({ data: err, level: 3 /* Error */, message: err.message });
};
return Logger;
}());
var LoggerImpl = /** @class */ (function () {
function LoggerImpl(activeLogLevel, subscribers) {
if (activeLogLevel === void 0) { activeLogLevel = 2 /* Warning */; }
if (subscribers === void 0) { subscribers = []; }
this.activeLogLevel = activeLogLevel;
this.subscribers = subscribers;
}
LoggerImpl.prototype.subscribe = function (listener) {
this.subscribers.push(listener);
};
LoggerImpl.prototype.clearSubscribers = function () {
var s = this.subscribers.slice(0);
this.subscribers.length = 0;
return s;
};
Object.defineProperty(LoggerImpl.prototype, "count", {
get: function () {
return this.subscribers.length;
},
enumerable: true,
configurable: true
});
LoggerImpl.prototype.write = function (message, level) {
if (level === void 0) { level = 0 /* Verbose */; }
this.log({ level: level, message: message });
};
LoggerImpl.prototype.log = function (entry) {
if (typeof entry !== "undefined" && this.activeLogLevel <= entry.level) {
this.subscribers.map(function (subscriber) { return subscriber.log(entry); });
Logger.subscribe = function () {
var listeners = [];
for (var _i = 0; _i < arguments.length; _i++) {
listeners[_i] = arguments[_i];
}
listeners.map(function (listener) { return Logger.instance.subscribe(listener); });
};
/**
* Clears the subscribers collection, returning the collection before modifiction
*/
Logger.clearSubscribers = function () {
return Logger.instance.clearSubscribers();
};
Object.defineProperty(Logger, "count", {
/**
* Gets the current subscriber count
*/
get: function () {
return Logger.instance.count;
},
enumerable: true,
configurable: true
});
/**
* Writes the supplied string to the subscribed listeners
*
* @param message The message to write
* @param level [Optional] if supplied will be used as the level of the entry (Default: LogLevel.Verbose)
*/
Logger.write = function (message, level) {
if (level === void 0) { level = 0 /* Verbose */; }
Logger.instance.log({ level: level, message: message });
};
/**
* Writes the supplied string to the subscribed listeners
*
* @param json The json object to stringify and write
* @param level [Optional] if supplied will be used as the level of the entry (Default: LogLevel.Verbose)
*/
Logger.writeJSON = function (json, level) {
if (level === void 0) { level = 0 /* Verbose */; }
Logger.instance.log({ level: level, message: JSON.stringify(json) });
};
/**
* Logs the supplied entry to the subscribed listeners
*
* @param entry The message to log
*/
Logger.log = function (entry) {
Logger.instance.log(entry);
};
/**
* Logs an error object to the subscribed listeners
*
* @param err The error object
*/
Logger.error = function (err) {
Logger.instance.log({ data: err, level: 3 /* Error */, message: err.message });
};
return Logger;
}());
var LoggerImpl = /** @class */ (function () {
function LoggerImpl(activeLogLevel, subscribers) {
if (activeLogLevel === void 0) { activeLogLevel = 2 /* Warning */; }
if (subscribers === void 0) { subscribers = []; }
this.activeLogLevel = activeLogLevel;
this.subscribers = subscribers;
}
};
return LoggerImpl;
}());
LoggerImpl.prototype.subscribe = function (listener) {
this.subscribers.push(listener);
};
LoggerImpl.prototype.clearSubscribers = function () {
var s = this.subscribers.slice(0);
this.subscribers.length = 0;
return s;
};
Object.defineProperty(LoggerImpl.prototype, "count", {
get: function () {
return this.subscribers.length;
},
enumerable: true,
configurable: true
});
LoggerImpl.prototype.write = function (message, level) {
if (level === void 0) { level = 0 /* Verbose */; }
this.log({ level: level, message: message });
};
LoggerImpl.prototype.log = function (entry) {
if (typeof entry !== "undefined" && this.activeLogLevel <= entry.level) {
this.subscribers.map(function (subscriber) { return subscriber.log(entry); });
}
};
return LoggerImpl;
}());
/**
* Implementation of LogListener which logs to the console
*
*/
var ConsoleListener = /** @class */ (function () {
function ConsoleListener() {
}
/**
* Any associated data that a given logging listener may choose to log or ignore
* Implementation of LogListener which logs to the console
*
* @param entry The information to be logged
*/
ConsoleListener.prototype.log = function (entry) {
var msg = this.format(entry);
switch (entry.level) {
case 0 /* Verbose */:
case 1 /* Info */:
console.log(msg);
break;
case 2 /* Warning */:
console.warn(msg);
break;
case 3 /* Error */:
console.error(msg);
break;
var ConsoleListener = /** @class */ (function () {
function ConsoleListener() {
}
};
/**
* Any associated data that a given logging listener may choose to log or ignore
*
* @param entry The information to be logged
*/
ConsoleListener.prototype.log = function (entry) {
var msg = this.format(entry);
switch (entry.level) {
case 0 /* Verbose */:
case 1 /* Info */:
console.log(msg);
break;
case 2 /* Warning */:
console.warn(msg);
break;
case 3 /* Error */:
console.error(msg);
break;
}
};
/**
* Formats the message
*
* @param entry The information to format into a string
*/
ConsoleListener.prototype.format = function (entry) {
var msg = [];
msg.push("Message: " + entry.message);
if (typeof entry.data !== "undefined") {
msg.push(" Data: " + JSON.stringify(entry.data));
}
return msg.join("");
};
return ConsoleListener;
}());
/**
* Formats the message
* Implementation of LogListener which logs to the supplied function
*
* @param entry The information to format into a string
*/
ConsoleListener.prototype.format = function (entry) {
var msg = [];
msg.push("Message: " + entry.message);
if (typeof entry.data !== "undefined") {
msg.push(" Data: " + JSON.stringify(entry.data));
var FunctionListener = /** @class */ (function () {
/**
* Creates a new instance of the FunctionListener class
*
* @constructor
* @param method The method to which any logging data will be passed
*/
function FunctionListener(method) {
this.method = method;
}
return msg.join("");
};
return ConsoleListener;
}());
/**
* Implementation of LogListener which logs to the supplied function
*
*/
var FunctionListener = /** @class */ (function () {
/**
* Creates a new instance of the FunctionListener class
*
* @constructor
* @param method The method to which any logging data will be passed
*/
function FunctionListener(method) {
this.method = method;
}
/**
* Any associated data that a given logging listener may choose to log or ignore
*
* @param entry The information to be logged
*/
FunctionListener.prototype.log = function (entry) {
this.method(entry);
};
return FunctionListener;
}());
/**
* Any associated data that a given logging listener may choose to log or ignore
*
* @param entry The information to be logged
*/
FunctionListener.prototype.log = function (entry) {
this.method(entry);
};
return FunctionListener;
}());
exports.Logger = Logger;
exports.ConsoleListener = ConsoleListener;
exports.FunctionListener = FunctionListener;
exports.Logger = Logger;
exports.ConsoleListener = ConsoleListener;
exports.FunctionListener = FunctionListener;
Object.defineProperty(exports, '__esModule', { value: true });
Object.defineProperty(exports, '__esModule', { value: true });
})));
//# sourceMappingURL=logging.es5.umd.js.map

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

!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n((e.pnp=e.pnp||{},e.pnp.logging={}))}(this,function(e){"use strict";var n=function(){function e(){}return Object.defineProperty(e,"activeLogLevel",{get:function(){return e.instance.activeLogLevel},set:function(n){e.instance.activeLogLevel=n},enumerable:!0,configurable:!0}),Object.defineProperty(e,"instance",{get:function(){return void 0!==e._instance&&null!==e._instance||(e._instance=new t),e._instance},enumerable:!0,configurable:!0}),e.subscribe=function(){for(var n=[],t=0;t<arguments.length;t++)n[t]=arguments[t];n.map(function(n){return e.instance.subscribe(n)})},e.clearSubscribers=function(){return e.instance.clearSubscribers()},Object.defineProperty(e,"count",{get:function(){return e.instance.count},enumerable:!0,configurable:!0}),e.write=function(n,t){void 0===t&&(t=0),e.instance.log({level:t,message:n})},e.writeJSON=function(n,t){void 0===t&&(t=0),e.instance.log({level:t,message:JSON.stringify(n)})},e.log=function(n){e.instance.log(n)},e.error=function(n){e.instance.log({data:n,level:3,message:n.message})},e}(),t=function(){function e(e,n){void 0===e&&(e=2),void 0===n&&(n=[]),this.activeLogLevel=e,this.subscribers=n}return e.prototype.subscribe=function(e){this.subscribers.push(e)},e.prototype.clearSubscribers=function(){var e=this.subscribers.slice(0);return this.subscribers.length=0,e},Object.defineProperty(e.prototype,"count",{get:function(){return this.subscribers.length},enumerable:!0,configurable:!0}),e.prototype.write=function(e,n){void 0===n&&(n=0),this.log({level:n,message:e})},e.prototype.log=function(e){void 0!==e&&this.activeLogLevel<=e.level&&this.subscribers.map(function(n){return n.log(e)})},e}(),i=function(){function e(){}return e.prototype.log=function(e){var n=this.format(e);switch(e.level){case 0:case 1:console.log(n);break;case 2:console.warn(n);break;case 3:console.error(n)}},e.prototype.format=function(e){var n=[];return n.push("Message: "+e.message),void 0!==e.data&&n.push(" Data: "+JSON.stringify(e.data)),n.join("")},e}(),o=function(){function e(e){this.method=e}return e.prototype.log=function(e){this.method(e)},e}();e.Logger=n,e.ConsoleListener=i,e.FunctionListener=o,Object.defineProperty(e,"__esModule",{value:!0})});
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n((e.pnp=e.pnp||{},e.pnp.logging={}))}(this,function(e){"use strict";var n=function(){function t(){}return Object.defineProperty(t,"activeLogLevel",{get:function(){return t.instance.activeLogLevel},set:function(e){t.instance.activeLogLevel=e},enumerable:!0,configurable:!0}),Object.defineProperty(t,"instance",{get:function(){return null==t._instance&&(t._instance=new o),t._instance},enumerable:!0,configurable:!0}),t.subscribe=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];e.map(function(e){return t.instance.subscribe(e)})},t.clearSubscribers=function(){return t.instance.clearSubscribers()},Object.defineProperty(t,"count",{get:function(){return t.instance.count},enumerable:!0,configurable:!0}),t.write=function(e,n){void 0===n&&(n=0),t.instance.log({level:n,message:e})},t.writeJSON=function(e,n){void 0===n&&(n=0),t.instance.log({level:n,message:JSON.stringify(e)})},t.log=function(e){t.instance.log(e)},t.error=function(e){t.instance.log({data:e,level:3,message:e.message})},t}(),o=function(){function e(e,n){void 0===e&&(e=2),void 0===n&&(n=[]),this.activeLogLevel=e,this.subscribers=n}return e.prototype.subscribe=function(e){this.subscribers.push(e)},e.prototype.clearSubscribers=function(){var e=this.subscribers.slice(0);return this.subscribers.length=0,e},Object.defineProperty(e.prototype,"count",{get:function(){return this.subscribers.length},enumerable:!0,configurable:!0}),e.prototype.write=function(e,n){void 0===n&&(n=0),this.log({level:n,message:e})},e.prototype.log=function(n){void 0!==n&&this.activeLogLevel<=n.level&&this.subscribers.map(function(e){return e.log(n)})},e}(),t=function(){function e(){}return e.prototype.log=function(e){var n=this.format(e);switch(e.level){case 0:case 1:console.log(n);break;case 2:console.warn(n);break;case 3:console.error(n)}},e.prototype.format=function(e){var n=[];return n.push("Message: "+e.message),void 0!==e.data&&n.push(" Data: "+JSON.stringify(e.data)),n.join("")},e}(),i=function(){function e(e){this.method=e}return e.prototype.log=function(e){this.method(e)},e}();e.Logger=n,e.ConsoleListener=t,e.FunctionListener=i,Object.defineProperty(e,"__esModule",{value:!0})});
/**
@license
* @pnp/logging v1.0.4-4 - pnp - light-weight, subscribable logging framework
* @pnp/logging v1.0.4 - pnp - light-weight, subscribable logging framework
* MIT (https://github.com/pnp/pnpjs/blob/master/LICENSE)

@@ -5,0 +5,0 @@ * Copyright (c) 2018 Microsoft

{
"name": "@pnp/logging",
"version": "1.0.4-4",
"version": "1.0.4",
"description": "pnp - light-weight, subscribable logging framework",

@@ -8,3 +8,3 @@ "main": "./dist/logging.es5.umd.js",

"dependencies": {
"tslib": "1.8.1"
"tslib": "1.9.0"
},

@@ -11,0 +11,0 @@ "author": {

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