diff --git a/src/cell.js b/src/cell.js index d1fff67..6ca815e 100644 --- a/src/cell.js +++ b/src/cell.js @@ -133,11 +133,11 @@ class Cell { draw(lineNum, spanningCell) { if (lineNum == 'top') return this.drawTop(this.drawRight); if (lineNum == 'bottom') return this.drawBottom(this.drawRight); - let content = utils.truncate(this.content, 10, this.truncate); if (!lineNum) { - info(`${this.y}-${this.x}: ${this.rowSpan - lineNum}x${this.colSpan} Cell ${content}`); - } else { - // debug(`${lineNum}-${this.x}: 1x${this.colSpan} RowSpanCell ${content}`); + info(() => { + const content = utils.truncate(this.content, 10, this.truncate); + return `${this.y}-${this.x}: ${this.rowSpan - lineNum}x${this.colSpan} Cell ${content}`; + }); } let padLen = Math.max(this.height - this.lines.length, 0); let padTop; diff --git a/src/debug.js b/src/debug.js index 6acfb03..00bc33c 100644 --- a/src/debug.js +++ b/src/debug.js @@ -3,7 +3,7 @@ let level = 0; const debug = (msg, min) => { if (level >= min) { - messages.push(msg); + messages.push(typeof msg === 'function' ? msg() : msg); } };