Comparing version 1.1.2 to 1.2.0
22
bows.js
@@ -55,2 +55,3 @@ (function() { | ||
var logArgs = [logger, msg]; | ||
if (colorsSupported) { | ||
@@ -64,14 +65,15 @@ if(!moduleColorsMap[str]){ | ||
logfn = bind.call(logger.log, logger, msg, colorString); | ||
logLevels.forEach(function (f) { | ||
logfn[f] = bind.call(logger[f] || logfn, logger, msg, colorString); | ||
}); | ||
} else { | ||
logfn = bind.call(logger.log, logger, msg); | ||
logLevels.forEach(function (f) { | ||
logfn[f] = bind.call(logger[f] || logfn, logger, msg); | ||
}); | ||
logArgs.push(colorString); | ||
} | ||
if(arguments.length>1){ | ||
var args = Array.prototype.slice.call(arguments, 1); | ||
logArgs = logArgs.concat(args); | ||
} | ||
logfn = bind.apply(logger.log, logArgs); | ||
logLevels.forEach(function (f) { | ||
logfn[f] = bind.call(logger[f] || logfn, logArgs); | ||
}); | ||
return logfn; | ||
@@ -78,0 +80,0 @@ }; |
{ | ||
"name": "bows", | ||
"version": "1.1.2", | ||
"version": "1.2.0", | ||
"description": "Rainbowed console logs for chrome, opera and firefox in development.", | ||
@@ -5,0 +5,0 @@ "main": "bows.js", |
@@ -45,2 +45,11 @@ # Bows | ||
- Typically each seperate module/view/etc in your app would create it's own logger. It will be assigned it's own color to make it easy to spot logs from different modules. | ||
- You can pass additional arguments to `bows` which will be automatically prepended to each message, e.g.: | ||
```js | ||
var log = bows("My App", "[ChuckNorris]"); | ||
log("Kicks ass!"); | ||
//outputs: | ||
//My App | [ChuckNorris] Kicks ass! | ||
``` | ||
- Logging is disabled by default. To enable logging, set `localStorage.debug = true` in your console and refresh the page. | ||
@@ -47,0 +56,0 @@ - You can leave the code in in production, and log() will just safely no-op unless localStorage.debug is set. |
@@ -10,2 +10,3 @@ var runTestPage = require('./helpers/runTestPage'); | ||
'test/padLength.html', | ||
'test/args.html' | ||
]; | ||
@@ -12,0 +13,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
89582
25
305
121