Commit 1cfb40ac by 陈思聪

fix: 请求入口日志打印

parent 491315f2
......@@ -232,6 +232,11 @@ module.exports = function (app) {
app.all("/web/*", async function (req, res, next) {
const self = this;
try{
console.log('[request:web] 【host:】'+req.hostname+',【url:】'+req.path+',【headers:】'+(req.headers?JSON.stringify(req.headers):"")+',【params:】'+(req.query?JSON.stringify(req.query):"")+',【body:】'+(req.body?JSON.stringify(req.body):""))
}catch (e){
console.log('[request:web] 打印请求入口日志报错:'+e.stack)
}
var result = system.getResult(null, "req method must is post");
if (req.method != "POST") {
res.end(JSON.stringify(result));
......@@ -410,6 +415,12 @@ module.exports = function (app) {
// return;
// });
app.all("/api/*", async function (req, res, next) {
try{
console.log('[request:api] 【host:】'+req.hostname+',【url:】'+req.path+',【headers:】'+(req.headers?JSON.stringify(req.headers):"")+',【params:】'+(req.query?JSON.stringify(req.query):"")+',【body:】'+(req.body?JSON.stringify(req.body):""))
}catch (e){
console.log('[request:api] 打印请求入口日志报错:'+e.stack)
}
let result = system.getResult(null, "req method must is post");
if (req.method != "POST") {
res.end(JSON.stringify(result));
......@@ -612,6 +623,11 @@ module.exports = function (app) {
//-----------------------新的模式---------ICP---------开始
app.all("/icp/*", async function (req, res, next) {
try{
console.log('[request:icp] 【host:】'+req.hostname+',【url:】'+req.path+',【headers:】'+(req.headers?JSON.stringify(req.headers):"")+',【params:】'+(req.query?JSON.stringify(req.query):"")+',【body:】'+(req.body?JSON.stringify(req.body):""))
}catch (e){
console.log('[request:icp] 打印请求入口日志报错:'+e.stack)
}
var result = system.getResult(null, "req method must is post");
if (req.method != "POST") {
res.end(JSON.stringify(result));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment