loglevel
Advanced tools
Comparing version 1.6.4 to 1.6.6
{ | ||
"name": "loglevel", | ||
"version": "1.6.4", | ||
"version": "1.6.6", | ||
"main": "dist/loglevel.min.js", | ||
@@ -5,0 +5,0 @@ "dependencies": {}, |
@@ -61,1 +61,6 @@ Filing tickets against loglevel | ||
8. Open a pull request back to master in loglevel | ||
Reporting security issues | ||
------------------------- | ||
Tidelift acts as the security contact for loglevel. Issues can be reported to security@tidelift.com, see https://tidelift.com/security for more details. |
@@ -1,2 +0,2 @@ | ||
/*! loglevel - v1.6.4 - https://github.com/pimterry/loglevel - (c) 2019 Tim Perry - licensed MIT */ | ||
/*! loglevel - v1.6.6 - https://github.com/pimterry/loglevel - (c) 2019 Tim Perry - licensed MIT */ | ||
(function (root, definition) { | ||
@@ -17,2 +17,5 @@ "use strict"; | ||
var undefinedType = "undefined"; | ||
var isIE = (typeof window !== undefinedType) && ( | ||
/Trident\/|MSIE /.test(window.navigator.userAgent) | ||
); | ||
@@ -44,2 +47,15 @@ var logMethods = [ | ||
// Trace() doesn't print the message in IE, so for that case we need to wrap it | ||
function traceForIE() { | ||
if (console.log) { | ||
if (console.log.apply) { | ||
console.log.apply(console, arguments); | ||
} else { | ||
// In old IE, native console methods themselves don't have apply(). | ||
Function.prototype.apply.apply(console.log, [console, arguments]); | ||
} | ||
} | ||
if (console.trace) console.trace(); | ||
} | ||
// Build the best logging method possible for this env | ||
@@ -54,2 +70,4 @@ // Wherever possible we want to bind, not wrap, to preserve stack traces | ||
return false; // No method possible, for now - fixed later by enableLoggingWhenConsoleArrives | ||
} else if (methodName === 'trace' && isIE) { | ||
return traceForIE; | ||
} else if (console[methodName] !== undefined) { | ||
@@ -56,0 +74,0 @@ return bindMethod(console, methodName); |
@@ -1,2 +0,2 @@ | ||
/*! loglevel - v1.6.4 - https://github.com/pimterry/loglevel - (c) 2019 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(b){return"debug"===b&&(b="log"),typeof console!==h&&(void 0!==console[b]?a(console,b):void 0!==console.log?a(console,"log"):g)}function c(a,b){for(var c=0;c<i.length;c++){var d=i[c];this[d]=c<a?g:this.methodFactory(d,a,b)}this.log=this.debug}function d(a,b,d){return function(){typeof console!==h&&(c.call(this,b,d),this[a].apply(this,arguments))}}function e(a,c,e){return b(a)||d.apply(this,arguments)}function f(a,b,d){function f(a){var b=(i[a]||"silent").toUpperCase();if(typeof window!==h){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!==h){try{a=window.localStorage[l]}catch(a){}if(typeof a===h)try{var b=window.document.cookie,c=b.indexOf(encodeURIComponent(l)+"=");-1!==c&&(a=/^([^;]+)/.exec(b.slice(c))[1])}catch(a){}return void 0===k.levels[a]&&(a=void 0),a}}var j,k=this,l="loglevel";a&&(l+=":"+a),k.name=a,k.levels={TRACE:0,DEBUG:1,INFO:2,WARN:3,ERROR:4,SILENT:5},k.methodFactory=d||e,k.getLevel=function(){return j},k.setLevel=function(b,d){if("string"==typeof b&&void 0!==k.levels[b.toUpperCase()]&&(b=k.levels[b.toUpperCase()]),!("number"==typeof b&&b>=0&&b<=k.levels.SILENT))throw"log.setLevel() called with invalid level: "+b;if(j=b,!1!==d&&f(b),c.call(k,b,a),typeof console===h&&b<k.levels.SILENT)return"No console available for logging"},k.setDefaultLevel=function(a){g()||k.setLevel(a,!1)},k.enableAll=function(a){k.setLevel(k.levels.TRACE,a)},k.disableAll=function(a){k.setLevel(k.levels.SILENT,a)};var m=g();null==m&&(m=null==b?"WARN":b),k.setLevel(m,!1)}var g=function(){},h="undefined",i=["trace","debug","info","warn","error"],j=new f,k={};j.getLogger=function(a){if("string"!=typeof a||""===a)throw new TypeError("You must supply a name when creating a logger.");var b=k[a];return b||(b=k[a]=new f(a,j.getLevel(),j.methodFactory)),b};var l=typeof window!==h?window.log:void 0;return j.noConflict=function(){return typeof window!==h&&window.log===j&&(window.log=l),j},j.getLoggers=function(){return k},j}); | ||
/*! loglevel - v1.6.6 - https://github.com/pimterry/loglevel - (c) 2019 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){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){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";a&&(l+=":"+a),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&&/Trident\/|MSIE /.test(window.navigator.userAgent),k=["trace","debug","info","warn","error"],l=new g,m={};l.getLogger=function(a){if("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}); |
@@ -94,7 +94,9 @@ 'use strict'; | ||
"jasmine_node": { | ||
options: { | ||
match: "node-integration.", | ||
matchall: true, | ||
projectRoot: "./test", | ||
useHelpers: false | ||
test: { | ||
options: { | ||
match: "node-integration.", | ||
matchall: true, | ||
projectRoot: "./test", | ||
useHelpers: false | ||
} | ||
} | ||
@@ -101,0 +103,0 @@ }, |
@@ -22,2 +22,5 @@ /* | ||
var undefinedType = "undefined"; | ||
var isIE = (typeof window !== undefinedType) && ( | ||
/Trident\/|MSIE /.test(window.navigator.userAgent) | ||
); | ||
@@ -49,2 +52,15 @@ var logMethods = [ | ||
// Trace() doesn't print the message in IE, so for that case we need to wrap it | ||
function traceForIE() { | ||
if (console.log) { | ||
if (console.log.apply) { | ||
console.log.apply(console, arguments); | ||
} else { | ||
// In old IE, native console methods themselves don't have apply(). | ||
Function.prototype.apply.apply(console.log, [console, arguments]); | ||
} | ||
} | ||
if (console.trace) console.trace(); | ||
} | ||
// Build the best logging method possible for this env | ||
@@ -59,2 +75,4 @@ // Wherever possible we want to bind, not wrap, to preserve stack traces | ||
return false; // No method possible, for now - fixed later by enableLoggingWhenConsoleArrives | ||
} else if (methodName === 'trace' && isIE) { | ||
return traceForIE; | ||
} else if (console[methodName] !== undefined) { | ||
@@ -61,0 +79,0 @@ return bindMethod(console, methodName); |
{ | ||
"name": "loglevel", | ||
"description": "Minimal lightweight logging for JavaScript, adding reliable log level methods to any available console.log methods", | ||
"version": "1.6.4", | ||
"version": "1.6.6", | ||
"homepage": "https://github.com/pimterry/loglevel", | ||
@@ -18,2 +18,6 @@ "author": { | ||
}, | ||
"funding": { | ||
"type": "tidelift", | ||
"url": "https://tidelift.com/subscription/pkg/npm-loglevel?utm_medium=referral&utm_source=npm_fund" | ||
}, | ||
"license": "MIT", | ||
@@ -20,0 +24,0 @@ "main": "lib/loglevel.js", |
@@ -130,3 +130,3 @@ | ||
Be aware that all this means that these method won't necessarily always produce exactly the output you expect in every environment; loglevel only guarantees that these methods will never explode on you, and that it will call the most relevant method it can find, with your argument. Firefox is a notable example here: due to a [current Firefox bug](https://bugzilla.mozilla.org/show_bug.cgi?id=1172314) `log.trace(msg)` calls in Firefox will print only the stacktrace, and won't include any passed message arguments. | ||
Be aware that all this means that these method won't necessarily always produce exactly the output you expect in every environment; loglevel only guarantees that these methods will never explode on you, and that it will call the most relevant method it can find, with your argument. For example, `log.trace(msg)` in IE11, and Firefox before version 64, prints the stacktrace by itself and doesn't include your message (see [#84](https://github.com/pimterry/loglevel/issues/84) & [#138](https://github.com/pimterry/loglevel/issues/138)). | ||
@@ -326,4 +326,8 @@ * A `log.setLevel(level, [persist])` method. | ||
v1.6.5 - Ensure the provided message is included when calling trace() in IE11 | ||
v1.6.6 - Fix bugs in v1.6.5, which caused issues in node.js & IE < 9 | ||
## License | ||
Copyright (c) 2013 Tim Perry | ||
Licensed under the MIT license. |
@@ -27,2 +27,2 @@ "use strict"; | ||
}); | ||
}); | ||
}); |
132681
36
2297
332