Always use verbosity-aware CLI logging

This commit is contained in:
Richard Gibson 2017-05-25 10:04:50 -04:00
parent 4cfd18e25f
commit ef25bfee14

View File

@ -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 = {