Comparing version 0.1.2 to 1.0.0
@@ -11,6 +11,5 @@ 'use strict'; | ||
QUnit.test("log.log works", function(){ | ||
QUnit.expect(2); | ||
QUnit.expect(1); | ||
var log = console.log; | ||
console.log = function(type, msg){ | ||
QUnit.equal(type, "INFO:"); | ||
console.log = function(msg){ | ||
QUnit.equal(msg, "it worked"); | ||
@@ -24,6 +23,5 @@ console.log = log; | ||
QUnit.test("log.warn works", function(){ | ||
QUnit.expect(2); | ||
QUnit.expect(1); | ||
var warn = console.warn; | ||
console.warn = function(type, msg){ | ||
QUnit.equal(type, "WARN:"); | ||
console.warn = function(msg){ | ||
QUnit.equal(msg, "it worked"); | ||
@@ -37,6 +35,5 @@ console.warn = warn; | ||
QUnit.test("log.error works", function(){ | ||
QUnit.expect(2); | ||
QUnit.expect(1); | ||
var error = console.error; | ||
console.error = function(type, msg){ | ||
QUnit.equal(type, "ERROR:"); | ||
console.error = function(msg){ | ||
QUnit.equal(msg, "an error"); | ||
@@ -43,0 +40,0 @@ console.error = error; |
@@ -11,3 +11,3 @@ 'use strict'; | ||
* @hide | ||
* | ||
* | ||
* Utilities for logging to the console. | ||
@@ -20,3 +20,3 @@ */ | ||
* @description | ||
* | ||
* | ||
* Adds a warning message to the console. | ||
@@ -26,3 +26,3 @@ * | ||
* var canLog = require("can-log"); | ||
* | ||
* | ||
* canLog.warn("something evil"); | ||
@@ -34,6 +34,5 @@ * ``` | ||
*/ | ||
exports.warn = function(out) { | ||
exports.warn = function() { | ||
var ll = this.logLevel; | ||
if (ll < 2) { | ||
Array.prototype.unshift.call(arguments, 'WARN:'); | ||
if (typeof console !== "undefined" && console.warn) { | ||
@@ -43,4 +42,2 @@ this._logger("warn", Array.prototype.slice.call(arguments)); | ||
this._logger("log", Array.prototype.slice.call(arguments)); | ||
} else if (window && window.opera && window.opera.postError) { | ||
window.opera.postError("CanJS WARNING: " + out); | ||
} | ||
@@ -59,3 +56,3 @@ } | ||
* var canLog = require("can-log"); | ||
* | ||
* | ||
* canLog.log("hi"); | ||
@@ -67,10 +64,7 @@ * ``` | ||
*/ | ||
exports.log = function(out) { | ||
exports.log = function() { | ||
var ll = this.logLevel; | ||
if (ll < 1) { | ||
if (typeof console !== "undefined" && console.log) { | ||
Array.prototype.unshift.call(arguments, 'INFO:'); | ||
this._logger("log", Array.prototype.slice.call(arguments)); | ||
} else if (window && window.opera && window.opera.postError) { | ||
window.opera.postError("CanJS INFO: " + out); | ||
} | ||
@@ -89,3 +83,3 @@ } | ||
* var canLog = require("can-log"); | ||
* | ||
* | ||
* canLog.error(new Error("Oh no!")); | ||
@@ -97,10 +91,7 @@ * ``` | ||
*/ | ||
exports.error = function(out) { | ||
exports.error = function() { | ||
var ll = this.logLevel; | ||
if (ll < 1) { | ||
if (typeof console !== "undefined" && console.error) { | ||
Array.prototype.unshift.call(arguments, 'ERROR:'); | ||
this._logger("error", Array.prototype.slice.call(arguments)); | ||
} else if (window && window.opera && window.opera.postError) { | ||
window.opera.postError("ERROR: " + out); | ||
} | ||
@@ -107,0 +98,0 @@ } |
@@ -1,2 +0,2 @@ | ||
/*can-log@0.1.1#can-log*/ | ||
/*can-log@0.1.2#can-log*/ | ||
define(function (require, exports, module) { | ||
@@ -6,6 +6,5 @@ 'use strict'; | ||
exports.logLevel = 0; | ||
exports.warn = function (out) { | ||
exports.warn = function () { | ||
var ll = this.logLevel; | ||
if (ll < 2) { | ||
Array.prototype.unshift.call(arguments, 'WARN:'); | ||
if (typeof console !== 'undefined' && console.warn) { | ||
@@ -15,26 +14,18 @@ this._logger('warn', Array.prototype.slice.call(arguments)); | ||
this._logger('log', Array.prototype.slice.call(arguments)); | ||
} else if (window && window.opera && window.opera.postError) { | ||
window.opera.postError('CanJS WARNING: ' + out); | ||
} | ||
} | ||
}; | ||
exports.log = function (out) { | ||
exports.log = function () { | ||
var ll = this.logLevel; | ||
if (ll < 1) { | ||
if (typeof console !== 'undefined' && console.log) { | ||
Array.prototype.unshift.call(arguments, 'INFO:'); | ||
this._logger('log', Array.prototype.slice.call(arguments)); | ||
} else if (window && window.opera && window.opera.postError) { | ||
window.opera.postError('CanJS INFO: ' + out); | ||
} | ||
} | ||
}; | ||
exports.error = function (out) { | ||
exports.error = function () { | ||
var ll = this.logLevel; | ||
if (ll < 1) { | ||
if (typeof console !== 'undefined' && console.error) { | ||
Array.prototype.unshift.call(arguments, 'ERROR:'); | ||
this._logger('error', Array.prototype.slice.call(arguments)); | ||
} else if (window && window.opera && window.opera.postError) { | ||
window.opera.postError('ERROR: ' + out); | ||
} | ||
@@ -41,0 +32,0 @@ } |
@@ -1,9 +0,8 @@ | ||
/*can-log@0.1.1#can-log*/ | ||
/*can-log@0.1.2#can-log*/ | ||
'use strict'; | ||
exports.warnTimeout = 5000; | ||
exports.logLevel = 0; | ||
exports.warn = function (out) { | ||
exports.warn = function () { | ||
var ll = this.logLevel; | ||
if (ll < 2) { | ||
Array.prototype.unshift.call(arguments, 'WARN:'); | ||
if (typeof console !== 'undefined' && console.warn) { | ||
@@ -13,26 +12,18 @@ this._logger('warn', Array.prototype.slice.call(arguments)); | ||
this._logger('log', Array.prototype.slice.call(arguments)); | ||
} else if (window && window.opera && window.opera.postError) { | ||
window.opera.postError('CanJS WARNING: ' + out); | ||
} | ||
} | ||
}; | ||
exports.log = function (out) { | ||
exports.log = function () { | ||
var ll = this.logLevel; | ||
if (ll < 1) { | ||
if (typeof console !== 'undefined' && console.log) { | ||
Array.prototype.unshift.call(arguments, 'INFO:'); | ||
this._logger('log', Array.prototype.slice.call(arguments)); | ||
} else if (window && window.opera && window.opera.postError) { | ||
window.opera.postError('CanJS INFO: ' + out); | ||
} | ||
} | ||
}; | ||
exports.error = function (out) { | ||
exports.error = function () { | ||
var ll = this.logLevel; | ||
if (ll < 1) { | ||
if (typeof console !== 'undefined' && console.error) { | ||
Array.prototype.unshift.call(arguments, 'ERROR:'); | ||
this._logger('error', Array.prototype.slice.call(arguments)); | ||
} else if (window && window.opera && window.opera.postError) { | ||
window.opera.postError('ERROR: ' + out); | ||
} | ||
@@ -39,0 +30,0 @@ } |
@@ -130,3 +130,3 @@ /*[global-shim-start]*/ | ||
/*can-log@0.1.1#can-log*/ | ||
/*can-log@0.1.2#can-log*/ | ||
define('can-log', function (require, exports, module) { | ||
@@ -136,6 +136,5 @@ 'use strict'; | ||
exports.logLevel = 0; | ||
exports.warn = function (out) { | ||
exports.warn = function () { | ||
var ll = this.logLevel; | ||
if (ll < 2) { | ||
Array.prototype.unshift.call(arguments, 'WARN:'); | ||
if (typeof console !== 'undefined' && console.warn) { | ||
@@ -145,26 +144,18 @@ this._logger('warn', Array.prototype.slice.call(arguments)); | ||
this._logger('log', Array.prototype.slice.call(arguments)); | ||
} else if (window && window.opera && window.opera.postError) { | ||
window.opera.postError('CanJS WARNING: ' + out); | ||
} | ||
} | ||
}; | ||
exports.log = function (out) { | ||
exports.log = function () { | ||
var ll = this.logLevel; | ||
if (ll < 1) { | ||
if (typeof console !== 'undefined' && console.log) { | ||
Array.prototype.unshift.call(arguments, 'INFO:'); | ||
this._logger('log', Array.prototype.slice.call(arguments)); | ||
} else if (window && window.opera && window.opera.postError) { | ||
window.opera.postError('CanJS INFO: ' + out); | ||
} | ||
} | ||
}; | ||
exports.error = function (out) { | ||
exports.error = function () { | ||
var ll = this.logLevel; | ||
if (ll < 1) { | ||
if (typeof console !== 'undefined' && console.error) { | ||
Array.prototype.unshift.call(arguments, 'ERROR:'); | ||
this._logger('error', Array.prototype.slice.call(arguments)); | ||
} else if (window && window.opera && window.opera.postError) { | ||
window.opera.postError('ERROR: ' + out); | ||
} | ||
@@ -171,0 +162,0 @@ } |
{ | ||
"name": "can-log", | ||
"version": "0.1.2", | ||
"version": "1.0.0", | ||
"description": "Utilities for logging to the console.", | ||
@@ -5,0 +5,0 @@ "homepage": "https://canjs.com/", |
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
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
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
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
0
21544
17
504
1