feat(log): 优化日志打印
All checks were successful
Egg Server MIflow / build-image (push) Successful in 41s
All checks were successful
Egg Server MIflow / build-image (push) Successful in 41s
This commit is contained in:
parent
8af3d6c118
commit
d283540b00
16
index.ts
16
index.ts
@ -12,15 +12,19 @@ initSchedule()
|
||||
|
||||
const server = Bun.serve({
|
||||
async fetch(req) {
|
||||
// 路由处理
|
||||
const { exactCheck, startsWithCheck, fullCheck } = makeCheckPathTool(
|
||||
req.url
|
||||
)
|
||||
// 生成上下文
|
||||
const ctx = await genContext(req)
|
||||
// 非健康检查由打印必要信息
|
||||
if (!fullCheck("/health")) {
|
||||
ctx.logger.info(`${req.method} ${req.url}`)
|
||||
logger.debug(`req body: ${ctx.text}`)
|
||||
}
|
||||
// 逻辑处理
|
||||
try {
|
||||
// 路由处理
|
||||
const { exactCheck, startsWithCheck, fullCheck } = makeCheckPathTool(
|
||||
req.url
|
||||
)
|
||||
// 非健康检查由打印
|
||||
if (!fullCheck("/health")) ctx.logger.info(`${req.method} ${req.url}`)
|
||||
// 机器人
|
||||
if (exactCheck("/bot")) return await manageBotReq(ctx)
|
||||
// 消息代理发送
|
||||
|
@ -26,7 +26,6 @@ const genContext = async (req: Request) => {
|
||||
} catch {
|
||||
/* empty */
|
||||
}
|
||||
logger.debug(`req body: ${text}`)
|
||||
return {
|
||||
req,
|
||||
requestId,
|
||||
|
Loading…
x
Reference in New Issue
Block a user