将错误日志保存到文件当中

This commit is contained in:
aixianling
2024-06-17 17:39:08 +08:00
parent 89987aeea1
commit 56021924ef
2 changed files with 8 additions and 7 deletions

1
.gitignore vendored
View File

@@ -2,3 +2,4 @@
/package-lock.json /package-lock.json
/zips/ /zips/
/aicode/ /aicode/
/logs/

View File

@@ -32,7 +32,7 @@ module.exports = {
return db.query(`update node_custom_config set download='${dayjs().format("YYYY-MM-DD HH:mm:ss")}',error='' where ${uniCon}`) return db.query(`update node_custom_config set download='${dayjs().format("YYYY-MM-DD HH:mm:ss")}',error='' where ${uniCon}`)
}).catch(err => { }).catch(err => {
console.log(err) console.log(err)
return db.query(`update node_custom_config set error='${err}',zipTime=null where ${uniCon}`) return fse.outputFile(`./logs/errors/${dayjs().format("YYYY-MM-DD")}.log`, err)
}) })
} else return response.send({code: 1, err: "无法找到定制项目信息"}) } else return response.send({code: 1, err: "无法找到定制项目信息"})
}).catch(err => { }).catch(err => {