Skip to content

Commit

Permalink
Revert "looks like formatting, and change pino to bunyan"
Browse files Browse the repository at this point in the history
This reverts commit db00a95.
  • Loading branch information
jessitron committed Dec 6, 2024
1 parent 32eca07 commit 8006572
Show file tree
Hide file tree
Showing 5 changed files with 258 additions and 198 deletions.
33 changes: 16 additions & 17 deletions src/frontend/middleware.ts
Original file line number Diff line number Diff line change
@@ -1,25 +1,24 @@
import { NextResponse } from 'next/server';
import type { NextRequest } from 'next/server';
import { NextResponse } from 'next/server'
import type { NextRequest } from 'next/server'
import { logger } from './utils/logger';

// This function can be marked `async` if using `await` inside
export function middleware(request: NextRequest) {
const startTime = Date.now();
const requestId = request.headers.get('x-request-id');
const response = NextResponse.next();
const duration = Date.now() - startTime;
logger.info({
'log.source': 'middleware.ts',
'http.method': request.method,
'request.id': requestId,
'http.url': request.url,
'http.status': response.status,
duration_ms: duration,
});
return response;
const startTime = Date.now();
const requestId = request.headers.get('x-request-id');
const response = NextResponse.next();
const duration = Date.now() - startTime;
logger.info(JSON.stringify({
"timestamp": new Date().toISOString(),
"http.method": request.method,
"request.id": requestId,
"http.url": request.url,
"http.status": response.status,
"duration_ms": duration}));
return response;
}

// See "Matching Paths" below to learn more
export const config = {
matcher: '/(.*)',
};
}
Loading

0 comments on commit 8006572

Please sign in to comment.