diff options
author | Matt Godbolt <mgodbolt@drw.com> | 2016-10-27 20:13:30 -0500 |
---|---|---|
committer | Matt Godbolt <mgodbolt@drw.com> | 2016-10-27 20:15:25 -0500 |
commit | 5a6de74105867c7b1b834af5629ad83c73e50473 (patch) | |
tree | f5f1346715547fd332915a24d58b3904f8219473 /lib/diff.js | |
parent | e3d22536c5c54f44282a1f6b7351ea82dd2f8253 (diff) | |
download | compiler-explorer-5a6de74105867c7b1b834af5629ad83c73e50473.tar.gz compiler-explorer-5a6de74105867c7b1b834af5629ad83c73e50473.zip |
Use winston for logging
Diffstat (limited to 'lib/diff.js')
-rw-r--r-- | lib/diff.js | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/lib/diff.js b/lib/diff.js index f78e32343..c456b1e17 100644 --- a/lib/diff.js +++ b/lib/diff.js @@ -2,6 +2,7 @@ var fs = require('fs'), child_process = require('child_process'), temp = require('temp'), path = require('path'), + logger = require('./logger').logger, Promise = require('promise') // jshint ignore:line ; @@ -106,15 +107,11 @@ function cleanAndGetIndexes(text) { memorizeText(); } - function log_error(string) { - console.log(string); - } - while (posInText < text.length) { var tag = tagLookup(rules, text, posInText); if (tag.seen && tag.type == TagTypeEnum.OPENING) { if (state != StateEnum.OUTSIDE_TAG) { - log_error("Opening tag while not outside tag (tags cannot be nested)"); + log.error("Opening tag while not outside tag (tags cannot be nested)"); return null; } currentTag = tag.rule; @@ -122,11 +119,11 @@ function cleanAndGetIndexes(text) { state = StateEnum.INSIDE_TAG; } else if (tag.seen && tag.type == TagTypeEnum.CLOSING) { if (state != StateEnum.INSIDE_TAG) { - log_error("Closing tag while not inside tag."); + log.error("Closing tag while not inside tag."); return null; } if (currentTag != tag.rule) { - log_error("Closing tag, but not of the same type as previously opened."); + log.error("Closing tag, but not of the same type as previously opened."); return null; } seenClosingTag(); @@ -161,12 +158,12 @@ function buildDiffHandler(config) { var error; if (before === undefined) { error = 'Warning : Bad request : wrong "before"'; - console.log(error); + logger.error(error); return next(new Error(error)); } if (after === undefined) { error = 'Warning : Bad request : wrong "after"'; - console.log(error); + logger.error(error); return next(new Error(error)); } |