Socket
Socket
Sign inDemoInstall

loglevel

Package Overview
Dependencies
0
Maintainers
1
Versions
30
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.6.0 to 1.0.0

test/test-qunit.html

4

bower.json
{
"name": "loglevel",
"version": "0.6.0",
"version": "1.0.0",
"main": "dist/loglevel.min.js",

@@ -11,2 +11,2 @@ "dependencies": {},

]
}
}

@@ -0,0 +0,0 @@ Filing tickets against loglevel

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

/*! loglevel - v0.6.0 - https://github.com/pimterry/loglevel - (c) 2014 Tim Perry - licensed MIT */
/*! loglevel - v1.0.0 - https://github.com/pimterry/loglevel - (c) 2014 Tim Perry - licensed MIT */
;(function (undefined) {

@@ -6,3 +6,3 @@ var undefinedType = "undefined";

(function (name, definition) {
if (typeof module !== 'undefined') {
if (typeof module === 'object' && module.exports && typeof require === 'function') {
module.exports = definition();

@@ -79,3 +79,4 @@ } else if (typeof define === 'function' && typeof define.amd === 'object') {

return (typeof window !== undefinedType &&
window.localStorage !== undefined);
window.localStorage !== undefined &&
window.localStorage !== null);
} catch (e) {

@@ -190,2 +191,13 @@ return false;

// Grab the current global log variable in case of overwrite
var _log = (typeof window !== undefinedType) ? window.log : undefined;
self.noConflict = function() {
if (typeof window !== undefinedType &&
window.log === self) {
window.log = _log;
}
return self;
};
loadPersistedLevel();

@@ -192,0 +204,0 @@ return self;

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

/*! loglevel - v0.6.0 - https://github.com/pimterry/loglevel - (c) 2014 Tim Perry - licensed MIT */
!function(a){var b="undefined";!function(a,b){"undefined"!=typeof module?module.exports=b():"function"==typeof define&&"object"==typeof define.amd?define(b):this[a]=b()}("log",function(){function c(c){return typeof console===b?l:console[c]===a?console.log!==a?d(console,"log"):l:d(console,c)}function d(b,c){var d=b[c];if(d.bind!==a)return b[c].bind(b);if(Function.prototype.bind===a)return e(d,b);try{return Function.prototype.bind.call(b[c],b)}catch(f){return e(d,b)}}function e(a,b){return function(){Function.prototype.apply.apply(a,[b,arguments])}}function f(a){for(var b=0;b<m.length;b++)k[m[b]]=a(m[b])}function g(){return typeof window!==b&&window.document!==a&&window.document.cookie!==a}function h(){try{return typeof window!==b&&window.localStorage!==a}catch(c){return!1}}function i(a){var b,c=!1;for(var d in k.levels)if(k.levels.hasOwnProperty(d)&&k.levels[d]===a){b=d;break}if(h())try{window.localStorage.loglevel=b}catch(e){c=!0}else c=!0;c&&g()&&(window.document.cookie="loglevel="+b+";")}function j(){var b;if(h()&&(b=window.localStorage.loglevel),b===a&&g()){var c=n.exec(window.document.cookie)||[];b=c[1]}k.levels[b]===a&&(b="WARN"),k.setLevel(k.levels[b])}var k={},l=function(){},m=["trace","debug","info","warn","error"],n=/loglevel=([^;]+)/;return k.levels={TRACE:0,DEBUG:1,INFO:2,WARN:3,ERROR:4,SILENT:5},k.setLevel=function(d){if("number"==typeof d&&d>=0&&d<=k.levels.SILENT){if(i(d),d===k.levels.SILENT)return void f(function(){return l});if(typeof console===b)return f(function(a){return function(){typeof console!==b&&(k.setLevel(d),k[a].apply(k,arguments))}}),"No console available for logging";f(function(a){return d<=k.levels[a.toUpperCase()]?c(a):l})}else{if("string"!=typeof d||k.levels[d.toUpperCase()]===a)throw"log.setLevel() called with invalid level: "+d;k.setLevel(k.levels[d.toUpperCase()])}},k.enableAll=function(){k.setLevel(k.levels.TRACE)},k.disableAll=function(){k.setLevel(k.levels.SILENT)},j(),k})}();
/*! loglevel - v1.0.0 - https://github.com/pimterry/loglevel - (c) 2014 Tim Perry - licensed MIT */
!function(a){var b="undefined";!function(a,b){"object"==typeof module&&module.exports&&"function"==typeof require?module.exports=b():"function"==typeof define&&"object"==typeof define.amd?define(b):this[a]=b()}("log",function(){function c(c){return typeof console===b?l:console[c]===a?console.log!==a?d(console,"log"):l:d(console,c)}function d(b,c){var d=b[c];if(d.bind!==a)return b[c].bind(b);if(Function.prototype.bind===a)return e(d,b);try{return Function.prototype.bind.call(b[c],b)}catch(f){return e(d,b)}}function e(a,b){return function(){Function.prototype.apply.apply(a,[b,arguments])}}function f(a){for(var b=0;b<m.length;b++)k[m[b]]=a(m[b])}function g(){return typeof window!==b&&window.document!==a&&window.document.cookie!==a}function h(){try{return typeof window!==b&&window.localStorage!==a&&null!==window.localStorage}catch(c){return!1}}function i(a){var b,c=!1;for(var d in k.levels)if(k.levels.hasOwnProperty(d)&&k.levels[d]===a){b=d;break}if(h())try{window.localStorage.loglevel=b}catch(e){c=!0}else c=!0;c&&g()&&(window.document.cookie="loglevel="+b+";")}function j(){var b;if(h()&&(b=window.localStorage.loglevel),b===a&&g()){var c=n.exec(window.document.cookie)||[];b=c[1]}k.levels[b]===a&&(b="WARN"),k.setLevel(k.levels[b])}var k={},l=function(){},m=["trace","debug","info","warn","error"],n=/loglevel=([^;]+)/;k.levels={TRACE:0,DEBUG:1,INFO:2,WARN:3,ERROR:4,SILENT:5},k.setLevel=function(d){if("number"==typeof d&&d>=0&&d<=k.levels.SILENT){if(i(d),d===k.levels.SILENT)return void f(function(){return l});if(typeof console===b)return f(function(a){return function(){typeof console!==b&&(k.setLevel(d),k[a].apply(k,arguments))}}),"No console available for logging";f(function(a){return d<=k.levels[a.toUpperCase()]?c(a):l})}else{if("string"!=typeof d||k.levels[d.toUpperCase()]===a)throw"log.setLevel() called with invalid level: "+d;k.setLevel(k.levels[d.toUpperCase()])}},k.enableAll=function(){k.setLevel(k.levels.TRACE)},k.disableAll=function(){k.setLevel(k.levels.SILENT)};var o=typeof window!==b?window.log:a;return k.noConflict=function(){return typeof window!==b&&window.log===k&&(window.log=o),k},j(),k})}();

@@ -87,6 +87,8 @@ 'use strict';

"jasmine_node": {
match: "node-integration.",
matchall: true,
projectRoot: "./test",
useHelpers: false
options: {
match: "node-integration.",
matchall: true,
projectRoot: "./test",
useHelpers: false
}
},

@@ -173,2 +175,5 @@ coveralls: {

}
},
qunit: {
all: ['test/*-qunit.html']
}

@@ -185,2 +190,3 @@ });

grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-qunit');

@@ -195,3 +201,3 @@ grunt.loadNpmTasks('grunt-contrib-connect');

// Check everything is good
grunt.registerTask('test', ['jshint', 'jasmine:requirejs', 'jasmine:global', 'jasmine_node', 'jasmine:withCoverage']);
grunt.registerTask('test', ['jshint', 'jasmine:requirejs', 'jasmine:global', 'jasmine_node', 'jasmine:withCoverage', 'qunit']);

@@ -198,0 +204,0 @@ // Test with a live server and an actual browser

@@ -12,3 +12,3 @@ /*

(function (name, definition) {
if (typeof module !== 'undefined') {
if (typeof module === 'object' && module.exports && typeof require === 'function') {
module.exports = definition();

@@ -85,3 +85,4 @@ } else if (typeof define === 'function' && typeof define.amd === 'object') {

return (typeof window !== undefinedType &&
window.localStorage !== undefined);
window.localStorage !== undefined &&
window.localStorage !== null);
} catch (e) {

@@ -196,2 +197,13 @@ return false;

// Grab the current global log variable in case of overwrite
var _log = (typeof window !== undefinedType) ? window.log : undefined;
self.noConflict = function() {
if (typeof window !== undefinedType &&
window.log === self) {
window.log = _log;
}
return self;
};
loadPersistedLevel();

@@ -198,0 +210,0 @@ return self;

{
"name": "loglevel",
"description": "Minimal lightweight logging for JavaScript, adding reliable log level methods to any available console.log methods",
"version": "0.6.0",
"version": "1.0.0",
"homepage": "https://github.com/pimterry/loglevel",

@@ -34,16 +34,18 @@ "author": {

"devDependencies": {
"grunt": "^0.4.1",
"grunt-cli": "^0.1.9",
"grunt-contrib-concat": "^0.3.0",
"grunt-contrib-uglify": "^0.3.0",
"grunt-contrib-jshint": "^0.8.0",
"grunt-contrib-watch": "^0.5.1",
"grunt-contrib-jasmine": "^0.5.2",
"grunt-template-jasmine-requirejs": "^0.1.6",
"grunt-template-jasmine-istanbul": "^0.2.5",
"grunt-open": "^0.2.2",
"grunt-saucelabs": "^5.0.0",
"grunt-contrib-connect": "^0.6.0",
"grunt-jasmine-node": "^0.1.0",
"grunt-coveralls": "^0.3.0"
"grunt": "~0.4.5",
"grunt-cli": "~0.1.13",
"grunt-contrib-concat": "~0.5.0",
"grunt-contrib-uglify": "~0.5.1",
"grunt-contrib-jshint": "~0.10.0",
"grunt-contrib-watch": "~0.6.1",
"grunt-contrib-jasmine": "~0.5.2",
"grunt-template-jasmine-requirejs": "~0.1.6",
"grunt-template-jasmine-istanbul": "~0.2.5",
"grunt-open": "~0.2.3",
"grunt-saucelabs": "^8.2.0",
"grunt-contrib-connect": "~0.8.0",
"grunt-jasmine-node": "~0.2.1",
"grunt-coveralls": "^1.0.0",
"grunt-contrib-qunit": "~0.5.2",
"qunitjs": "^1.14.0"
},

@@ -50,0 +52,0 @@ "jam": {

@@ -32,3 +32,3 @@ # loglevel [![Build Status](https://travis-ci.org/pimterry/loglevel.png)](https://travis-ci.org/pimterry/loglevel) [![Coverage Status](https://coveralls.io/repos/pimterry/loglevel/badge.png?branch=master)](https://coveralls.io/r/pimterry/loglevel?branch=master) [![Dependency status](https://david-dm.org/pimterry/loglevel/dev-status.png)](https://david-dm.org/pimterry/loglevel#info=devDependencies&view=table)

loglevel is also available via [Bower](https://github.com/bower/bower) (`bower install loglevel`) or [JamJS](http://jamjs.org/packages/#/details/loglevel) (`jam install loglevel`)
loglevel is also available via [Bower](https://github.com/bower/bower) (`bower install loglevel`), [JamJS](http://jamjs.org/packages/#/details/loglevel) (`jam install loglevel`) or as a [Webjar](http://www.webjars.org/).

@@ -70,2 +70,17 @@ Alternatively if you just want to grab the file yourself, you can download either the current stable [production version][min] or the [development version][max] directly, or reference it remotely on CDNJS at `//cdnjs.cloudflare.com/ajax/libs/loglevel/0.5.0/loglevel.min.js`

### With noConflict():
If you're using another JavaScript library that exposes a 'log' global, you can run into conflicts with loglevel. Similarly to jQuery, you can solve this by putting loglevel into no-conflict mode immediately after it is loaded onto the page. This resets to 'log' global to its value before loglevel was loaded (typically `undefined`), and returns the loglevel object, which you can then bind to another name yourself.
For example:
```html
<script src="loglevel.min.js"></script>
<script>
var logging = log.noConflict();
logging.error("still pretty easy");
</script>
```
## Documentation

@@ -139,2 +154,4 @@

v1.0.0 - Official stable release. Fixed a bug with localStorage in Android webviews, improved CommonJS detection, and added noConflict().
## License

@@ -145,5 +162,1 @@ Copyright (c) 2013 Tim Perry

[![githalytics.com alpha](https://cruel-carlota.pagodabox.com/3393271900ddc6808ae1901f3760a59e)](http://githalytics.com/pimterry/loglevel)
[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/pimterry/loglevel/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ /* global log */

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ /*

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

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc