浏览代码

log levels

isundil 5 年之前
父节点
当前提交
605a377553
共有 1 个文件被更改,包括 7 次插入7 次删除
  1. 7 7
      quizz.js

+ 7 - 7
quizz.js

@@ -81,7 +81,7 @@ Question.toHint = function(response, normalizedResponse, boundaries, responseInd
         return "Un nombre entre " +boundaries[0] +" et " +boundaries[1];
     }
     else
-        console.error("Unknown response type !");
+        console.error("ERROR: Unknown response type !");
 };
 
 Question.prototype.getHint = function(hintLevel) {
@@ -166,7 +166,7 @@ const ScoreUtils = (function() {
 
 function initQuestionList(filename) {
     return new Promise((ok, ko) => {
-        console.info("Reloading question db");
+        console.info("INFO: Reloading question db");
         var stream = fs.createReadStream(filename),
             reader = readline.createInterface({input: stream}),
             questions = [],
@@ -184,7 +184,7 @@ function initQuestionList(filename) {
                 if (question.question && question.response)
                     questions.push(question);
             } catch (e) {
-                console.error("Failed to load Database: ", e, "on line", lineNo);
+                console.error("ERROR: Failed to load Database: ", e, "on line", lineNo);
                 borken = true;
                 reader.close();
                 stream.destroy();
@@ -314,7 +314,7 @@ QuizzBot.prototype.nextQuestionWrapper = function() {
 
 QuizzBot.prototype.nextQuestion = function() {
     this.currentQuestion = this.questions[Math.floor(Math.random() * this.questions.length)];
-    console.debug(JSON.stringify(this.currentQuestion));
+    console.debug("DEBUG: " +JSON.stringify(this.currentQuestion));
     this.currentHint = 0;
     this.questionDate = Date.now();
     this.bot.sendMsg(this.room, "#" +this.currentQuestion.id +" " +this.currentQuestion.question);
@@ -670,15 +670,15 @@ QuizzBot.prototype.mySQLExport = function() {
     this.exportScores().then(() => {
         Cache.setExportTs();
         this.resetScores();
-        console.info("Successfully exported scores to MySQL");
+        console.info("INFO: Successfully exported scores to MySQL");
         this.mySQLExportWrapper();
     }).catch((errString) => {
-        console.error("mySQL Export error saving to database: ", errString);
+        console.error("ERROR: mySQL Export error saving to database: ", errString);
     });
 }
 
 QuizzBot.prototype.exportScores = function() {
-    console.info("Start exporting scores");
+    console.info("INFO: Start exporting scores");
     return new Promise((ok, ko) => {
         if (!MySQL)
             return ko();