debug
Advanced tools
Comparing version 1.0.3 to 1.0.4
@@ -29,5 +29,5 @@ | ||
/** | ||
* Currently only WebKit-based Web Inspectors and the Firebug | ||
* extension (*not* the built-in Firefox web inpector) are | ||
* known to support "%c" CSS customizations. | ||
* Currently only WebKit-based Web Inspectors, Firefox >= v31, | ||
* and the Firebug extension (any Firefox version) are known | ||
* to support "%c" CSS customizations. | ||
* | ||
@@ -41,3 +41,6 @@ * TODO: add a `localStorage` variable to explicitly enable/disable colors | ||
// is firebug? http://stackoverflow.com/a/398120/376773 | ||
(window.console && (console.firebug || (console.exception && console.table))); | ||
(window.console && (console.firebug || (console.exception && console.table))) || | ||
// is firefox >= v31? | ||
// https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages | ||
(navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31); | ||
} | ||
@@ -66,3 +69,3 @@ | ||
+ this.namespace | ||
+ (useColors ? '%c ' : ' ') | ||
+ (useColors ? ' %c' : ' ') | ||
+ args[0] | ||
@@ -75,3 +78,3 @@ + (useColors ? '%c ' : ' ') | ||
var c = 'color: ' + this.color; | ||
args = [args[0], c, ''].concat(Array.prototype.slice.call(args, 1)); | ||
args = [args[0], c, 'color: inherit'].concat(Array.prototype.slice.call(args, 1)); | ||
@@ -78,0 +81,0 @@ // the final "%c" is somewhat tricky, because there could be other |
@@ -5,3 +5,3 @@ { | ||
"description": "small debugging utility", | ||
"version": "1.0.3", | ||
"version": "1.0.4", | ||
"keywords": [ | ||
@@ -8,0 +8,0 @@ "debug", |
@@ -116,3 +116,3 @@ | ||
} | ||
var logFn = exports.log || enabled.log || console.log.bind(console); | ||
var logFn = enabled.log || exports.log || console.log.bind(console); | ||
logFn.apply(self, args); | ||
@@ -119,0 +119,0 @@ } |
1.0.4 / 2014-07-15 | ||
================== | ||
* dist: recompile | ||
* example: remove `console.info()` log usage | ||
* example: add "Content-Type" UTF-8 header to browser example | ||
* browser: place %c marker after the space character | ||
* browser: reset the "content" color via `color: inherit` | ||
* browser: add colors support for Firefox >= v31 | ||
* debug: prefer an instance `log()` function over the global one (#119) | ||
* Readme: update documentation about styled console logs for FF v31 (#116, @wryk) | ||
1.0.3 / 2014-07-09 | ||
@@ -3,0 +15,0 @@ ================== |
{ | ||
"name": "debug", | ||
"version": "1.0.3", | ||
"version": "1.0.4", | ||
"repository": { | ||
@@ -5,0 +5,0 @@ "type": "git", |
@@ -94,3 +94,6 @@ # debug | ||
Colors are also enabled on "Web Inspectors" that understand the `%c` formatting | ||
option. These are WebKit web inspectors, and the Firebug plugin for Firefox. | ||
option. These are WebKit web inspectors, Firefox ([since version | ||
31](https://hacks.mozilla.org/2014/05/editable-box-model-multiple-selection-sublime-text-keys-much-more-firefox-developer-tools-episode-31/)) | ||
and the Firebug plugin for Firefox (any version). | ||
Colored output looks something like: | ||
@@ -97,0 +100,0 @@ |
21264
407
157