mirror of
https://github.com/debug-js/debug.git
synced 2026-01-18 16:12:38 +00:00
dist: recompile
This commit is contained in:
parent
872115d10a
commit
91daf2860d
21
dist/debug.js
vendored
21
dist/debug.js
vendored
@ -58,16 +58,13 @@ exports.formatters.j = function(v) {
|
||||
function log() {
|
||||
var args = arguments;
|
||||
var useColors = this.useColors;
|
||||
var curr = new Date();
|
||||
var ms = curr - (this.prev || curr);
|
||||
this.prev = curr;
|
||||
|
||||
args[0] = (useColors ? '%c' : '')
|
||||
+ this.namespace
|
||||
+ (useColors ? '%c ' : ' ')
|
||||
+ args[0]
|
||||
+ (useColors ? '%c ' : ' ')
|
||||
+ '+' + exports.humanize(ms);
|
||||
+ '+' + exports.humanize(this.diff);
|
||||
|
||||
if (useColors) {
|
||||
var c = 'color: ' + this.color;
|
||||
@ -169,6 +166,12 @@ exports.formatters = {};
|
||||
|
||||
var prevColor = 0;
|
||||
|
||||
/**
|
||||
* Previous log timestamp.
|
||||
*/
|
||||
|
||||
var prevTime;
|
||||
|
||||
/**
|
||||
* Select a color.
|
||||
*
|
||||
@ -197,8 +200,17 @@ function debug(namespace) {
|
||||
|
||||
// define the `enabled` version
|
||||
function enabled() {
|
||||
|
||||
var self = enabled;
|
||||
|
||||
// set `diff` timestamp
|
||||
var curr = +new Date();
|
||||
var ms = curr - (prevTime || curr);
|
||||
self.diff = ms;
|
||||
self.prev = prevTime;
|
||||
self.curr = curr;
|
||||
prevTime = curr;
|
||||
|
||||
// add the `color` if not set
|
||||
if (null == self.useColors) self.useColors = exports.useColors();
|
||||
if (null == self.color && self.useColors) self.color = selectColor();
|
||||
@ -256,6 +268,7 @@ function enable(namespaces) {
|
||||
var len = split.length;
|
||||
|
||||
for (var i = 0; i < len; i++) {
|
||||
if (!split[i]) continue; // ignore empty strings
|
||||
namespaces = split[i].replace('*', '.*?');
|
||||
if (namespaces[0] === '-') {
|
||||
exports.skips.push(new RegExp('^' + namespaces.substr(1) + '$'));
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user