feat(log): 剔除无用日志打印
Some checks failed
Egg Server MIflow / build-image (push) Failing after 29s

This commit is contained in:
zhaoyingbo 2024-09-20 10:46:27 +00:00
parent dee4c49e9d
commit f6c472f138
4 changed files with 9 additions and 3 deletions

View File

@ -5,6 +5,7 @@
"Chakroun",
"commitlint",
"dbaeumer",
"devcontainer",
"devcontainers",
"eamodio",
"esbenp",

BIN
bun.lockb

Binary file not shown.

View File

@ -19,7 +19,12 @@ const server = Bun.serve({
// 生成上下文
const ctx = await genContext(req)
// 非健康检查由打印必要信息
if (!fullCheck("/health")) {
if (
exactCheck("/bot") ||
exactCheck("/message") ||
exactCheck("/sheet") ||
startsWithCheck("/micro_app")
) {
ctx.logger.info(`${req.method} ${req.url}`)
ctx.logger.debug(`req body: ${ctx.text}`)
}
@ -36,7 +41,7 @@ const server = Bun.serve({
// 健康检查
if (fullCheck("/health")) return ctx.genResp.healthCheck()
// 其他
return ctx.genResp.ok("hello, there is egg, glade to serve you!")
return ctx.genResp.healthCheck("hello, there is egg, glade to serve you!")
} catch (error: any) {
// 错误处理
return ctx.genResp.serverError(error.message || "server error")

View File

@ -37,7 +37,7 @@
"@egg/hooks": "^1.2.0",
"@egg/lark-msg-tool": "^1.2.0",
"@egg/logger": "^1.3.0",
"@egg/net-tool": "^1.5.1",
"@egg/net-tool": "^1.6.0",
"@egg/path-tool": "^1.3.0",
"node-schedule": "^2.1.1",
"p-limit": "^6.1.0",