feat(logger): add debug logging for matched routes (#19287)

This commit is contained in:
Tony 2025-06-05 19:55:45 +08:00 committed by GitHub
parent f1117bcd1e
commit e10c3a51ee
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 2 additions and 0 deletions

View File

@ -9,6 +9,7 @@ import index from '@/routes/index';
import healthz from '@/routes/healthz';
import robotstxt from '@/routes/robots.txt';
import metrics from '@/routes/metrics';
import logger from '@/utils/logger';
const __dirname = import.meta.dirname;
@ -157,6 +158,7 @@ for (const namespace in namespaces) {
for (const [path, routeData] of sortedRoutes) {
const wrappedHandler: Handler = async (ctx) => {
logger.debug(`Matched route: ${ctx.req.routePath}`);
if (!ctx.get('data')) {
if (typeof routeData.handler !== 'function') {
if (process.env.NODE_ENV === 'test') {