Comparing version 1.6.0 to 1.6.1
{ | ||
"name": "loglevel", | ||
"version": "1.6.0", | ||
"version": "1.6.1", | ||
"main": "dist/loglevel.min.js", | ||
@@ -5,0 +5,0 @@ "dependencies": {}, |
@@ -1,2 +0,2 @@ | ||
/*! loglevel - v1.6.0 - https://github.com/pimterry/loglevel - (c) 2017 Tim Perry - licensed MIT */ | ||
/*! loglevel - v1.6.1 - https://github.com/pimterry/loglevel - (c) 2018 Tim Perry - licensed MIT */ | ||
(function (root, definition) { | ||
@@ -3,0 +3,0 @@ "use strict"; |
@@ -1,2 +0,2 @@ | ||
/*! loglevel - v1.6.0 - https://github.com/pimterry/loglevel - (c) 2017 Tim Perry - licensed MIT */ | ||
/*! loglevel - v1.6.1 - https://github.com/pimterry/loglevel - (c) 2018 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}); |
{ | ||
"name": "loglevel", | ||
"description": "Minimal lightweight logging for JavaScript, adding reliable log level methods to any available console.log methods", | ||
"version": "1.6.0", | ||
"version": "1.6.1", | ||
"homepage": "https://github.com/pimterry/loglevel", | ||
@@ -6,0 +6,0 @@ "author": { |
# loglevel [![NPM version][npm-image]][npm-url] [![NPM downloads](https://img.shields.io/npm/dw/loglevel.svg)](https://www.npmjs.com/package/loglevel) [![Build status](https://travis-ci.org/pimterry/loglevel.png)](https://travis-ci.org/pimterry/loglevel) [![Coveralls percentage](https://img.shields.io/coveralls/pimterry/loglevel.svg)](https://coveralls.io/r/pimterry/loglevel?branch=master) | ||
[npm-image]: https://img.shields.io/npm/v/loglevel.svg?style=flat | ||
@@ -12,4 +11,2 @@ [npm-url]: https://npmjs.org/package/loglevel | ||
<a target='_blank' rel='nofollow' href='https://app.codesponsor.io/link/iJW7FWKrcEHBcxrqjGxT9JPS/pimterry/loglevel'> <img alt='Sponsor' width='888' height='68' src='https://app.codesponsor.io/embed/iJW7FWKrcEHBcxrqjGxT9JPS/pimterry/loglevel.svg' /></a> | ||
## Features | ||
@@ -59,3 +56,3 @@ | ||
var log = require('loglevel'); | ||
log.info("unreasonably simple"); | ||
log.warn("unreasonably simple"); | ||
``` | ||
@@ -76,3 +73,3 @@ | ||
<script> | ||
log.error("too easy"); | ||
log.warn("too easy"); | ||
</script> | ||
@@ -85,3 +82,3 @@ ``` | ||
import * as log from 'loglevel'; | ||
log.debug("all done"); | ||
log.warn("ultra-compatible"); | ||
``` | ||
@@ -100,3 +97,3 @@ | ||
logging.error("still pretty easy"); | ||
logging.warn("still pretty easy"); | ||
</script> | ||
@@ -273,3 +270,2 @@ ``` | ||
* Run `npm publish .` to publish to NPM | ||
* Autoupdate gh-pages docs | ||
@@ -311,4 +307,6 @@ ## Release History | ||
v1.6.1 - Various small documentation & test updates | ||
## License | ||
Copyright (c) 2013 Tim Perry | ||
Licensed under the MIT license. |
@@ -109,2 +109,25 @@ "use strict"; | ||
it("loggers have independent method factories", function(log) { | ||
var log1 = log.getLogger('logger1'); | ||
var log2 = log.getLogger('logger2'); | ||
var log1Spy = jasmine.createSpy('log1spy'); | ||
log1.methodFactory = function(methodName, level) { | ||
return log1Spy; | ||
}; | ||
log1.setLevel(log1.getLevel()); | ||
var log2Spy = jasmine.createSpy('log2spy'); | ||
log2.methodFactory = function(methodName, level) { | ||
return log2Spy; | ||
}; | ||
log2.setLevel(log2.getLevel()); | ||
log1.error('test1'); | ||
log2.error('test2'); | ||
expect(log1Spy).toHaveBeenCalledWith("test1"); | ||
expect(log2Spy).toHaveBeenCalledWith("test2"); | ||
}); | ||
it("new loggers correctly inherit a logging level of `0`", function(log) { | ||
@@ -111,0 +134,0 @@ log.setLevel(0); |
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
120997
2099
306