mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-09-20 07:49:43 +02:00
Always use verbosity-aware CLI logging
This commit is contained in:
@@ -46,7 +46,7 @@ var options = {
|
|||||||
width: width,
|
width: width,
|
||||||
outputSuffix: system.args[9]
|
outputSuffix: system.args[9]
|
||||||
}
|
}
|
||||||
// var log = logger(options.verbose)
|
var log = logger(options.verbose)
|
||||||
options.sequenceConfig.useMaxWidth = false
|
options.sequenceConfig.useMaxWidth = false
|
||||||
|
|
||||||
page.content = [
|
page.content = [
|
||||||
@@ -63,10 +63,10 @@ page.content = [
|
|||||||
|
|
||||||
page.injectJs('../dist/mermaid.js')
|
page.injectJs('../dist/mermaid.js')
|
||||||
page.onConsoleMessage = function (msg, lineNum, sourceId) {
|
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) {
|
files.forEach(function (file) {
|
||||||
var contents = fs.read(file)
|
var contents = fs.read(file)
|
||||||
@@ -75,7 +75,7 @@ files.forEach(function (file) {
|
|||||||
var oDOM
|
var oDOM
|
||||||
var svgContent
|
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
|
// 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
|
// 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')
|
page.render(outputPath + '.png')
|
||||||
console.log('saved png: ' + filename + '.png')
|
log('saved png: ' + filename + '.png')
|
||||||
}
|
}
|
||||||
|
|
||||||
if (options.svg) {
|
if (options.svg) {
|
||||||
@@ -109,13 +109,12 @@ files.forEach(function (file) {
|
|||||||
, serialize.serializeToString(oDOM) + '\n'
|
, serialize.serializeToString(oDOM) + '\n'
|
||||||
, 'w'
|
, 'w'
|
||||||
)
|
)
|
||||||
console.log('saved svg: ' + filename + '.svg')
|
log('saved svg: ' + filename + '.svg')
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
window.phantom.exit()
|
window.phantom.exit()
|
||||||
|
|
||||||
/*
|
|
||||||
function logger (_verbose) {
|
function logger (_verbose) {
|
||||||
var verbose = _verbose
|
var verbose = _verbose
|
||||||
|
|
||||||
@@ -131,7 +130,6 @@ function logger (_verbose) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
|
|
||||||
function resolveSVGElement (element) {
|
function resolveSVGElement (element) {
|
||||||
var prefix = {
|
var prefix = {
|
||||||
|
Reference in New Issue
Block a user