Comparing version 1.7.0 to 1.7.1
{ | ||
"name": "loglevel", | ||
"version": "1.7.0", | ||
"version": "1.7.1", | ||
"main": "dist/loglevel.min.js", | ||
@@ -5,0 +5,0 @@ "dependencies": {}, |
@@ -1,2 +0,2 @@ | ||
/*! loglevel - v1.7.0 - https://github.com/pimterry/loglevel - (c) 2020 Tim Perry - licensed MIT */ | ||
/*! loglevel - v1.7.1 - https://github.com/pimterry/loglevel - (c) 2020 Tim Perry - licensed MIT */ | ||
(function (root, definition) { | ||
@@ -3,0 +3,0 @@ "use strict"; |
@@ -1,2 +0,2 @@ | ||
/*! loglevel - v1.7.0 - https://github.com/pimterry/loglevel - (c) 2020 Tim Perry - licensed MIT */ | ||
/*! loglevel - v1.7.1 - https://github.com/pimterry/loglevel - (c) 2020 Tim Perry - licensed MIT */ | ||
!function(a,b){"use strict";"function"==typeof define&&define.amd?define(b):"object"==typeof module&&module.exports?module.exports=b():a.log=b()}(this,function(){"use strict";function a(a,b){var c=a[b];if("function"==typeof c.bind)return c.bind(a);try{return Function.prototype.bind.call(c,a)}catch(b){return function(){return Function.prototype.apply.apply(c,[a,arguments])}}}function b(){console.log&&(console.log.apply?console.log.apply(console,arguments):Function.prototype.apply.apply(console.log,[console,arguments])),console.trace&&console.trace()}function c(c){return"debug"===c&&(c="log"),typeof console!==i&&("trace"===c&&j?b:void 0!==console[c]?a(console,c):void 0!==console.log?a(console,"log"):h)}function d(a,b){for(var c=0;c<k.length;c++){var d=k[c];this[d]=c<a?h:this.methodFactory(d,a,b)}this.log=this.debug}function e(a,b,c){return function(){typeof console!==i&&(d.call(this,b,c),this[a].apply(this,arguments))}}function f(a,b,d){return c(a)||e.apply(this,arguments)}function g(a,b,c){function e(a){var b=(k[a]||"silent").toUpperCase();if(typeof window!==i&&l){try{return void(window.localStorage[l]=b)}catch(a){}try{window.document.cookie=encodeURIComponent(l)+"="+b+";"}catch(a){}}}function g(){var a;if(typeof window!==i&&l){try{a=window.localStorage[l]}catch(a){}if(typeof a===i)try{var b=window.document.cookie,c=b.indexOf(encodeURIComponent(l)+"=");-1!==c&&(a=/^([^;]+)/.exec(b.slice(c))[1])}catch(a){}return void 0===j.levels[a]&&(a=void 0),a}}var h,j=this,l="loglevel";"string"==typeof a?l+=":"+a:"symbol"==typeof a&&(l=void 0),j.name=a,j.levels={TRACE:0,DEBUG:1,INFO:2,WARN:3,ERROR:4,SILENT:5},j.methodFactory=c||f,j.getLevel=function(){return h},j.setLevel=function(b,c){if("string"==typeof b&&void 0!==j.levels[b.toUpperCase()]&&(b=j.levels[b.toUpperCase()]),!("number"==typeof b&&b>=0&&b<=j.levels.SILENT))throw"log.setLevel() called with invalid level: "+b;if(h=b,!1!==c&&e(b),d.call(j,b,a),typeof console===i&&b<j.levels.SILENT)return"No console available for logging"},j.setDefaultLevel=function(a){g()||j.setLevel(a,!1)},j.enableAll=function(a){j.setLevel(j.levels.TRACE,a)},j.disableAll=function(a){j.setLevel(j.levels.SILENT,a)};var m=g();null==m&&(m=null==b?"WARN":b),j.setLevel(m,!1)}var h=function(){},i="undefined",j=typeof window!==i&&typeof window.navigator!==i&&/Trident\/|MSIE /.test(window.navigator.userAgent),k=["trace","debug","info","warn","error"],l=new g,m={};l.getLogger=function(a){if("symbol"!=typeof a&&"string"!=typeof a||""===a)throw new TypeError("You must supply a name when creating a logger.");var b=m[a];return b||(b=m[a]=new g(a,l.getLevel(),l.methodFactory)),b};var n=typeof window!==i?window.log:void 0;return l.noConflict=function(){return typeof window!==i&&window.log===l&&(window.log=n),l},l.getLoggers=function(){return m},l.default=l,l}); |
@@ -42,3 +42,3 @@ // Originally from Definitely Typed, see: | ||
type MethodFactory = (methodName: string, level: LogLevelNumbers, loggerName: string) => LoggingMethod; | ||
type MethodFactory = (methodName: string, level: LogLevelNumbers, loggerName: string | symbol) => LoggingMethod; | ||
@@ -56,4 +56,4 @@ interface RootLogger extends Logger { | ||
* This gets you a new logger object that works exactly like the root log object, but can have its level and | ||
* logging methods set independently. All loggers must have a name (which is a non-empty string). Calling | ||
* getLogger() multiple times with the same name will return an identical logger object. | ||
* logging methods set independently. All loggers must have a name (which is a non-empty string or a symbol) | ||
* Calling * getLogger() multiple times with the same name will return an identical logger object. | ||
* In large applications, it can be incredibly useful to turn logging on and off for particular modules as you are | ||
@@ -67,3 +67,3 @@ * working with them. Using the getLogger() method lets you create a separate logger for each part of your | ||
*/ | ||
getLogger(name: string): Logger; | ||
getLogger(name: string | symbol): Logger; | ||
@@ -70,0 +70,0 @@ /** |
{ | ||
"name": "loglevel", | ||
"description": "Minimal lightweight logging for JavaScript, adding reliable log level methods to any available console.log methods", | ||
"version": "1.7.0", | ||
"version": "1.7.1", | ||
"homepage": "https://github.com/pimterry/loglevel", | ||
@@ -20,3 +20,3 @@ "author": { | ||
"type": "tidelift", | ||
"url": "https://tidelift.com/subscription/pkg/npm-loglevel?utm_medium=referral&utm_source=npm_fund" | ||
"url": "https://tidelift.com/funding/github/npm/loglevel" | ||
}, | ||
@@ -23,0 +23,0 @@ "license": "MIT", |
@@ -344,2 +344,4 @@ | ||
v1.7.1 - Update TypeScript types to support Symbol-named loggers. | ||
## `loglevel` for enterprise | ||
@@ -346,0 +348,0 @@ |
@@ -38,3 +38,3 @@ "use strict"; | ||
// Use the API to make sure it doesn't blantantly fail with exceptions | ||
// Use the API to make sure it doesn't blatantly fail with exceptions | ||
logging.trace("a trace message"); | ||
@@ -41,0 +41,0 @@ logging.debug("a debug message"); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
135989
355