From ef25bfee1445c80cce66f9542109bbc582aea6e0 Mon Sep 17 00:00:00 2001 From: Richard Gibson Date: Thu, 25 May 2017 10:04:50 -0400 Subject: [PATCH] Always use verbosity-aware CLI logging --- lib/phantomscript.js | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/lib/phantomscript.js b/lib/phantomscript.js index c2e445ff0..43a21e859 100644 --- a/lib/phantomscript.js +++ b/lib/phantomscript.js @@ -46,7 +46,7 @@ var options = { width: width, outputSuffix: system.args[9] } -// var log = logger(options.verbose) +var log = logger(options.verbose) options.sequenceConfig.useMaxWidth = false page.content = [ @@ -63,10 +63,10 @@ page.content = [ page.injectJs('../dist/mermaid.js') page.onConsoleMessage = function (msg, lineNum, sourceId) { - console.log('CONSOLE: ' + msg + ' (from line #' + lineNum + ' in "' + sourceId + '")') + log('CONSOLE: ' + msg + ' (from line #' + lineNum + ' in "' + sourceId + '")') } -console.log('Num files to execute : ' + files.length) +log('Num files to execute : ' + files.length) files.forEach(function (file) { var contents = fs.read(file) @@ -75,7 +75,7 @@ files.forEach(function (file) { var oDOM var svgContent - console.log('ready to execute png: ' + filename + '.png ') + log('ready to execute png: ' + filename + '.png ') // this JS is executed in this statement is sandboxed, even though it doesn't // look like it. we need to serialize then unserialize the svgContent that's @@ -100,7 +100,7 @@ files.forEach(function (file) { } page.render(outputPath + '.png') - console.log('saved png: ' + filename + '.png') + log('saved png: ' + filename + '.png') } if (options.svg) { @@ -109,13 +109,12 @@ files.forEach(function (file) { , serialize.serializeToString(oDOM) + '\n' , 'w' ) - console.log('saved svg: ' + filename + '.svg') + log('saved svg: ' + filename + '.svg') } }) window.phantom.exit() -/* function logger (_verbose) { var verbose = _verbose @@ -131,7 +130,6 @@ function logger (_verbose) { } } } -*/ function resolveSVGElement (element) { var prefix = {