fix: 修复一个优选逻辑错误的bug

pull/180/head
xiaojunnuo 2020-11-20 16:05:58 +08:00
parent dd2e36007d
commit 52e1d04e09
5 changed files with 7 additions and 6 deletions

View File

@ -5,7 +5,7 @@ const getDefaultConfigBasePath = function () {
return path.resolve(userHome, './.dev-sidecar')
}
log4js.configure({
appenders: { std: { type: 'stdout' }, file: { type: 'file', pattern: 'yyyy-MM-dd', daysToKeep: 3, filename: getDefaultConfigBasePath() + '/logs/server.log' } },
appenders: { std: { type: 'stdout' }, file: { type: 'file', pattern: 'yyyy-MM-dd', daysToKeep: 3, filename: getDefaultConfigBasePath() + '/logs/core.log' } },
categories: { default: { appenders: ['file', 'std'], level: 'info' } }
})
const logger = log4js.getLogger('server')

View File

@ -5,7 +5,7 @@ const getDefaultConfigBasePath = function () {
return path.resolve(userHome, './.dev-sidecar')
}
log4js.configure({
appenders: { std: { type: 'stdout' }, file: { type: 'file', pattern: 'yyyy-MM-dd', daysToKeep: 3, filename: getDefaultConfigBasePath() + '/logs/server.log' } },
appenders: { std: { type: 'stdout' }, file: { type: 'file', pattern: 'yyyy-MM-dd', daysToKeep: 3, filename: getDefaultConfigBasePath() + '/logs/gui.log' } },
categories: { default: { appenders: ['file', 'std'], level: 'info' } }
})
const logger = log4js.getLogger('server')

View File

@ -33,9 +33,8 @@ class DynamicChoice {
* @param backupList
*/
setBackupList (backupList) {
this.value = backupList.shift()
this.backup = backupList
let defaultTotal = backupList.length > 6 ? backupList.length : 6
let defaultTotal = backupList.length
for (const item of backupList) {
if (this.count[item]) {
continue
@ -43,6 +42,7 @@ class DynamicChoice {
this.count[item] = { value: item, total: defaultTotal, error: 0, keepErrorCount: 0, successRate: 1 }
defaultTotal--
}
this.value = backupList.shift()
this.doCount(this.value, false)
}

View File

@ -50,6 +50,7 @@ module.exports = {
rOptions.port = rOptions.protocol === 'https:' ? 443 : 80
}
log.info('proxy:', rOptions.hostname, proxyTarget)
log.debug('proxy choice:', JSON.stringify(context.requestCount))
return true
},
is (interceptOpt) {

View File

@ -1,8 +1,8 @@
const log4js = require('log4js')
const proxyConfig = require('../lib/proxy/common/config')
log4js.configure({
appenders: { std: { type: 'stdout' }, file: { type: 'file', pattern: 'yyyy-MM-dd', daysToKeep: 3, filename: proxyConfig.getDefaultCABasePath() + '/logs/server.log' } },
categories: { default: { appenders: ['file', 'std'], level: 'info' } }
appenders: { std: { type: 'stdout', level: 'debug' }, file: { type: 'file', pattern: 'yyyy-MM-dd', daysToKeep: 3, filename: proxyConfig.getDefaultCABasePath() + '/logs/server.log' } },
categories: { default: { appenders: ['file', 'std'], level: 'debug' } }
})
const logger = log4js.getLogger('server')
module.exports = logger