Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions bows.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
bind = Function.prototype.bind,
hue = 0,
padLength = 15,
profile = true,
noop = function() {},
// if ls.debugColors is set, use that, otherwise check for support
colorsSupported = ls.debugColors ? (ls.debugColors !== "false") : checkColorSupport(),
Expand Down Expand Up @@ -68,6 +69,14 @@

if (!bind) return noop;

if (profile) {
var interval = new Date();
var now = (new Date()).getTime();
interval.toString = function() {
return -now + (now = new Date().getTime())
}
}

var logArgs = [logger];
if (colorsSupported) {
if(!moduleColorsMap[str]){
Expand All @@ -77,11 +86,24 @@
msg = "%c" + msg;
colorString = "color: hsl(" + (color) + ",99%,40%); font-weight: bold";

if (profile) {
msg += " +%sms ";
}

logArgs.push(msg, colorString);
}else{

if (profile) {
msg += " +%sms ";
}

logArgs.push(msg);
}

if (profile) {
logArgs.push(interval);
}

if(arguments.length>1){
var args = Array.prototype.slice.call(arguments, 1);
logArgs = logArgs.concat(args);
Expand All @@ -99,6 +121,9 @@
if (config.padLength) {
padLength = config.padLength;
}
if (config.profile !== null) {
profile = config.profile;
}
};

if (typeof module !== 'undefined') {
Expand Down
25 changes: 25 additions & 0 deletions dist/bows.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
bind = Function.prototype.bind,
hue = 0,
padLength = 15,
profile = true,
noop = function() {},
// if ls.debugColors is set, use that, otherwise check for support
colorsSupported = ls.debugColors ? (ls.debugColors !== "false") : checkColorSupport(),
Expand Down Expand Up @@ -69,6 +70,14 @@

if (!bind) return noop;

if (profile) {
var interval = new Date();
var now = (new Date()).getTime();
interval.toString = function() {
return -now + (now = new Date().getTime())
}
}

var logArgs = [logger];
if (colorsSupported) {
if(!moduleColorsMap[str]){
Expand All @@ -78,11 +87,24 @@
msg = "%c" + msg;
colorString = "color: hsl(" + (color) + ",99%,40%); font-weight: bold";

if (profile) {
msg += " +%sms ";
}

logArgs.push(msg, colorString);
}else{

if (profile) {
msg += " +%sms ";
}

logArgs.push(msg);
}

if (profile) {
logArgs.push(interval);
}

if(arguments.length>1){
var args = Array.prototype.slice.call(arguments, 1);
logArgs = logArgs.concat(args);
Expand All @@ -100,6 +122,9 @@
if (config.padLength) {
padLength = config.padLength;
}
if (config.profile !== null) {
profile = config.profile;
}
};

if (typeof module !== 'undefined') {
Expand Down
2 changes: 1 addition & 1 deletion dist/bows.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.