[misc] test/scripts: use logger-sharelatex for logging as in production

This commit is contained in:
Jakob Ackermann 2020-11-10 09:40:38 +00:00
parent d827b521c6
commit ccf4bb1e0e
4 changed files with 1123 additions and 4 deletions

File diff suppressed because it is too large Load diff

View file

@ -29,6 +29,7 @@
"eslint-plugin-prettier": "^3.1.3",
"eslint-plugin-promise": "^4.2.1",
"eslint-plugin-standard": "^4.0.1",
"logger-sharelatex": "^2.2.0",
"mocha": "^8.2.1",
"prettier": "^2.0.2",
"prettier-eslint-cli": "^5.0.0",

View file

@ -7,6 +7,7 @@
*/
const redis = require('../../../')
const logger = require('logger-sharelatex')
const rclient = redis.createClient({
cluster: Array.from({ length: 9 }).map((value, index) => {
@ -17,9 +18,9 @@ const rclient = redis.createClient({
setInterval(() => {
rclient.healthCheck((err) => {
if (err) {
console.log('HEALTH CHECK FAILED', err)
logger.error({ err }, 'HEALTH CHECK FAILED')
} else {
console.log('HEALTH CHECK OK')
logger.log('HEALTH CHECK OK')
}
})
}, 1000)

View file

@ -2,15 +2,16 @@
// starting and stopping redis with this script running is a good test
const redis = require('../../')
const logger = require('logger-sharelatex')
const rclient = redis.createClient({ host: 'localhost', port: '6379' })
setInterval(() => {
rclient.healthCheck((err) => {
if (err) {
console.log('HEALTH CHECK FAILED', err)
logger.error({ err }, 'HEALTH CHECK FAILED')
} else {
console.log('HEALTH CHECK OK')
logger.log('HEALTH CHECK OK')
}
})
}, 1000)