Browse Source

optimize: 日志优化。

pull/360/head
王良 2 months ago
parent
commit
a5f2b9565c
  1. 0
      packages/core/test/httpsVerifyTest.js
  2. 0
      packages/core/test/macProxyTest.js
  3. 2
      packages/gui/src/bridge/update/backend.js
  4. 6
      packages/mitmproxy/src/lib/proxy/mitmproxy/createRequestHandler.js

0
packages/core/test/https.verify.js → packages/core/test/httpsVerifyTest.js

0
packages/core/test/macProxy.js → packages/core/test/macProxyTest.js

2
packages/gui/src/bridge/update/backend.js

@ -30,7 +30,7 @@ function downloadFile (uri, filePath, onProgress, onSuccess, onError) {
})
.on('error', function (err) {
// Do something with err
log.error('下载升级包失败', err)
log.error('下载升级包失败:', err)
onError(err)
})
.on('end', function () {

6
packages/mitmproxy/src/lib/proxy/mitmproxy/createRequestHandler.js

@ -16,6 +16,7 @@ module.exports = function createRequestHandler (createIntercepts, middlewares, e
let proxyReq
const rOptions = commonUtil.getOptionsFromRequest(req, ssl, externalProxy, setting)
const url = `${rOptions.method}${rOptions.protocol}//${rOptions.hostname}:${rOptions.port}${rOptions.path}`
if (rOptions.agent) {
rOptions.agent.options.rejectUnauthorized = setting.verifySsl
@ -108,7 +109,6 @@ module.exports = function createRequestHandler (createIntercepts, middlewares, e
onFree()
function onFree () {
const url = `${rOptions.method}${rOptions.protocol}//${rOptions.hostname}:${rOptions.port}${rOptions.path}`
const start = new Date()
log.info('发起代理请求:', url, (rOptions.servername ? ', sni: ' + rOptions.servername : ''))
@ -225,7 +225,7 @@ module.exports = function createRequestHandler (createIntercepts, middlewares, e
// })
proxyRes.on('error', (error) => {
countSlow(null, 'error: ' + error.message)
log.error('proxy res error:', error)
log.error(`proxy res error: ${url}, error:`, error)
})
const responseInterceptorPromise = new Promise((resolve, reject) => {
@ -331,7 +331,7 @@ module.exports = function createRequestHandler (createIntercepts, middlewares, e
}
// endregion
log.error('Request error:', e)
log.error(`Request error: ${url}, error:`, e)
}
})
}

Loading…
Cancel
Save