MCPcopy Index your code
hub / github.com/CommandCodeAI/BaseAI / logger

Function logger

packages/baseai/src/dev/middleware/logger.ts:3–20  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1import type { MiddlewareHandler } from 'hono';
2
3export const logger = (): MiddlewareHandler => {
4 return async function logger(c, next) {
5 await next();
6 c.req.matchedRoutes.forEach(({ handler, method, path }, i) => {
7 const name =
8 handler.name ||
9 (handler.length < 2 ? '[handler]' : '[middleware]');
10 console.log(
11 method,
12 ' ',
13 path,
14 ' '.repeat(Math.max(10 - path.length, 0)),
15 name,
16 i === c.req.routeIndex ? '<- respond from here' : ''
17 );
18 });
19 };
20};

Callers

nothing calls this directly

Calls 2

logMethod · 0.80
nextFunction · 0.50

Tested by

no test coverage detected