Henry Oswald 7 лет назад
Родитель
Сommit
b89db17ea6

+ 1 - 1
services/spelling/app/coffee/ASpell.coffee

@@ -63,7 +63,7 @@ class ASpellRunner
 			for k, v of addToCache
 			for k, v of addToCache
 				cache.set(k, v)
 				cache.set(k, v)
 
 
-			logger.log hits: hits, total: words.length, hitrate: (hits/words.length).toFixed(2), "cache hit rate"
+			logger.info hits: hits, total: words.length, hitrate: (hits/words.length).toFixed(2), "cache hit rate"
 			callback null, results
 			callback null, results
 
 
 	getSuggestions: (language, output) ->
 	getSuggestions: (language, output) ->

+ 5 - 5
services/spelling/app/coffee/ASpellWorker.coffee

@@ -10,11 +10,11 @@ class ASpellWorker
 		@language = language
 		@language = language
 		@count = 0
 		@count = 0
 		@pipe = child_process.spawn("aspell", ["pipe", "-t", "--encoding=utf-8", "-d", language])
 		@pipe = child_process.spawn("aspell", ["pipe", "-t", "--encoding=utf-8", "-d", language])
-		logger.log process: @pipe.pid, lang: @language, "starting new aspell worker"
+		logger.info process: @pipe.pid, lang: @language, "starting new aspell worker"
 		metrics.inc "aspellWorker-start-" + @language
 		metrics.inc "aspellWorker-start-" + @language
 		@pipe.on 'exit', () =>
 		@pipe.on 'exit', () =>
 			@state = 'killed'
 			@state = 'killed'
-			logger.log process: @pipe.pid, lang: @language, "aspell worker has exited"
+			logger.info process: @pipe.pid, lang: @language, "aspell worker has exited"
 			metrics.inc "aspellWorker-exit-" + @language
 			metrics.inc "aspellWorker-exit-" + @language
 		@pipe.on 'close', () =>
 		@pipe.on 'close', () =>
 			@state = 'closed' unless @state == 'killed'
 			@state = 'closed' unless @state == 'killed'
@@ -30,7 +30,7 @@ class ASpellWorker
 				@callback = null
 				@callback = null
 		@pipe.stdin.on 'error', (err) =>
 		@pipe.stdin.on 'error', (err) =>
 			@state = 'error' unless @state == 'killed'
 			@state = 'error' unless @state == 'killed'
-			logger.log process: @pipe.pid, error: err, stdout: output.slice(-1024), stderr: error.slice(-1024), lang: @language, "aspell worker error on stdin"
+			logger.info process: @pipe.pid, error: err, stdout: output.slice(-1024), stderr: error.slice(-1024), lang: @language, "aspell worker error on stdin"
 			if @callback?
 			if @callback?
 				@callback err, []
 				@callback err, []
 				@callback = null
 				@callback = null
@@ -89,12 +89,12 @@ class ASpellWorker
 		@sendCommand("$$l")
 		@sendCommand("$$l")
 
 
 	shutdown: (reason) ->
 	shutdown: (reason) ->
-		logger.log process: @pipe.pid, reason: reason, 'shutting down'
+		logger.info process: @pipe.pid, reason: reason, 'shutting down'
 		@state = "closing"
 		@state = "closing"
 		@pipe.stdin.end()
 		@pipe.stdin.end()
 
 
 	kill: (reason) ->
 	kill: (reason) ->
-		logger.log process: @pipe.pid, reason: reason, 'killing'
+		logger.info process: @pipe.pid, reason: reason, 'killing'
 		return if @state == 'killed'
 		return if @state == 'killed'
 		@pipe.kill('SIGKILL')
 		@pipe.kill('SIGKILL')
 
 

+ 1 - 1
services/spelling/app/coffee/ASpellWorkerPool.coffee

@@ -24,7 +24,7 @@ class ASpellWorkerPool
 			if worker.idleTimer?
 			if worker.idleTimer?
 				clearTimeout worker.idleTimer
 				clearTimeout worker.idleTimer
 				worker.idleTimer = null
 				worker.idleTimer = null
-			logger.log process: worker.pipe.pid, lang: language, "removing aspell worker from pool"
+			logger.info process: worker.pipe.pid, lang: language, "removing aspell worker from pool"
 			@cleanup()
 			@cleanup()
 		@PROCESS_POOL.push(worker)
 		@PROCESS_POOL.push(worker)
 		metrics.gauge 'aspellWorkerPool-size', @PROCESS_POOL.length
 		metrics.gauge 'aspellWorkerPool-size', @PROCESS_POOL.length

+ 2 - 2
services/spelling/app/coffee/SpellingAPIController.coffee

@@ -5,7 +5,7 @@ metrics = require('metrics-sharelatex')
 module.exports = SpellingAPIController =
 module.exports = SpellingAPIController =
 	check: (req, res, next) ->
 	check: (req, res, next) ->
 		metrics.inc "spelling-check", 0.1
 		metrics.inc "spelling-check", 0.1
-		logger.log token: req?.params?.user_id, word_count: req?.body?.words?.length, "running check"
+		logger.info token: req?.params?.user_id, word_count: req?.body?.words?.length, "running check"
 		SpellingAPIManager.runRequest req.params.user_id, req.body, (error, result) ->
 		SpellingAPIManager.runRequest req.params.user_id, req.body, (error, result) ->
 			if error?
 			if error?
 				logger.err err:error, user_id:req?.params?.user_id, word_count: req?.body?.words?.length, "error processing spelling request"
 				logger.err err:error, user_id:req?.params?.user_id, word_count: req?.body?.words?.length, "error processing spelling request"
@@ -14,7 +14,7 @@ module.exports = SpellingAPIController =
 
 
 	learn: (req, res, next) ->
 	learn: (req, res, next) ->
 		metrics.inc "spelling-learn", 0.1
 		metrics.inc "spelling-learn", 0.1
-		logger.log token: req?.params?.user_id, word: req?.body?.word, "learning word"
+		logger.info token: req?.params?.user_id, word: req?.body?.word, "learning word"
 		SpellingAPIManager.learnWord req.params.user_id, req.body, (error, result) ->
 		SpellingAPIManager.learnWord req.params.user_id, req.body, (error, result) ->
 			return next(error) if error?
 			return next(error) if error?
 			res.sendStatus(200)
 			res.sendStatus(200)

+ 1 - 0
services/spelling/test/unit/coffee/ASpellTests.coffee

@@ -9,6 +9,7 @@ describe "ASpell", ->
 		@ASpell = SandboxedModule.require "../../../app/js/ASpell", requires:
 		@ASpell = SandboxedModule.require "../../../app/js/ASpell", requires:
 			"logger-sharelatex":
 			"logger-sharelatex":
 				log:->
 				log:->
+				info:->
 				err:->
 				err:->
 			'metrics-sharelatex':
 			'metrics-sharelatex':
 				gauge:->
 				gauge:->