This commit is contained in:
André Cruz
2013-05-23 20:06:51 +01:00
parent 27b39c29b8
commit 086fda5f24
3 changed files with 9 additions and 5 deletions

View File

@@ -2,7 +2,7 @@ var mout = require('mout');
var paddings = {
tag: 10,
tagPlusLabel: 30
tagPlusLabel: 35
};
var tagColors = {
@@ -11,8 +11,6 @@ var tagColors = {
'_default': 'cyan',
};
// -------------------------
function renderData(data) {
// Ensure data
data.data = data.data || '';
@@ -33,7 +31,7 @@ function renderError(err) {
str += err.details + '\n';
}
// Print trace
// Print stack
str += '\n' + err.stack + '\n';
return str;
@@ -69,7 +67,7 @@ function renderTagPlusLabel(data) {
length = tag.length + label.length + 1;
nrSpaces = paddings.tagPlusLabel - length;
// Make at least one space
// Ensure at least one space
if (nrSpaces < 1) {
nrSpaces = 1;
}
@@ -77,6 +75,8 @@ function renderTagPlusLabel(data) {
return tag[tagColor] + mout.string.repeat(' ', nrSpaces) + label.green;
}
// -------------------------
module.exports.colorful = {};
module.exports.colorful.head = empty;
module.exports.colorful.tail = empty;

View File

@@ -30,6 +30,8 @@ function stringify(data) {
return uncolor(circularJson.stringify(data, null, ' '));
}
// -------------------------
module.exports.head = renderHead;
module.exports.tail = renderTail;

View File

@@ -2,6 +2,8 @@ function empty() {
return '';
}
// -------------------------
module.exports.data = empty;
module.exports.error = empty;
module.exports.end = empty;