From 74b0da065ed4b76f21b3e71c8168be7fbac13d63 Mon Sep 17 00:00:00 2001 From: Jermolene Date: Sat, 18 Feb 2017 13:30:04 +0000 Subject: [PATCH] Add logging functions to commander --- core/modules/commander.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/core/modules/commander.js b/core/modules/commander.js index 6c4f687e7..ad7f4b5b3 100644 --- a/core/modules/commander.js +++ b/core/modules/commander.js @@ -29,6 +29,24 @@ var Commander = function(commandTokens,callback,wiki,streams) { this.outputPath = path.resolve($tw.boot.wikiPath,$tw.config.wikiOutputSubDir); }; +/* +Log a string if verbose flag is set +*/ +Commander.prototype.log = function(str) { + if(this.verbose) { + this.streams.output.write(str + "\n"); + } +}; + +/* +Write a string if verbose flag is set +*/ +Commander.prototype.write = function(str) { + if(this.verbose) { + this.streams.output.write(str); + } +}; + /* Add a string of tokens to the command queue */