日志小调整。

pull/292/head
王良 2024-04-10 21:57:47 +08:00
parent 118c55fd51
commit 4b5076f9f7
2 changed files with 5 additions and 5 deletions

View File

@ -66,7 +66,7 @@ const configApi = {
return return
} }
if (response && response.statusCode === 200) { if (response && response.statusCode === 200) {
if (body == null || body.length < 3) { if (body == null || body.length < 2) {
log.warn('下载远程配置成功,但内容为空:', remoteConfigUrl) log.warn('下载远程配置成功,但内容为空:', remoteConfigUrl)
resolve() resolve()
return return
@ -120,7 +120,7 @@ const configApi = {
log.warn('远程配置文件不存在:', path) log.warn('远程配置文件不存在:', path)
} }
} catch (e) { } catch (e) {
log.error('远程配置读取失败:', path, ', error:', e) log.error('读取远程配置文件失败:', path, ', error:', e)
} }
return {} return {}
@ -132,14 +132,14 @@ const configApi = {
try { try {
const path = _getRemoteSavePath() const path = _getRemoteSavePath()
if (fs.existsSync(path)) { if (fs.existsSync(path)) {
log.info('读取远程配置文件内容:', path)
const file = fs.readFileSync(path) const file = fs.readFileSync(path)
log.info('读取远程配置文件内容成功:', path)
return file.toString() return file.toString()
} else { } else {
log.warn('远程配置文件不存在:', path) log.warn('远程配置文件不存在:', path)
} }
} catch (e) { } catch (e) {
log.warn('远程配置内容读取失败:', e) log.error('读取远程配置文件内容失败:', e)
} }
return '{}' return '{}'

View File

@ -73,7 +73,7 @@ const serverApi = {
const basePath = serverConfig.setting.userBasePath const basePath = serverConfig.setting.userBasePath
const runningConfigPath = path.join(basePath, '/running.json') const runningConfigPath = path.join(basePath, '/running.json')
fs.writeFileSync(runningConfigPath, jsonApi.stringify(serverConfig)) fs.writeFileSync(runningConfigPath, jsonApi.stringify(serverConfig))
log.info('保存 running.json 成功:', runningConfigPath) log.info('保存 running.json 运行时配置文件成功:', runningConfigPath)
const serverProcess = fork(mitmproxyPath, [runningConfigPath]) const serverProcess = fork(mitmproxyPath, [runningConfigPath])
server = { server = {
id: serverProcess.pid, id: serverProcess.pid,