This commit is contained in:
parent
ee45e41d6d
commit
82116a7405
@ -2,13 +2,13 @@ import { NextResponse, type NextRequest } from "next/server";
|
|||||||
import { isProduction } from "@ssr/common/utils/utils";
|
import { isProduction } from "@ssr/common/utils/utils";
|
||||||
|
|
||||||
export function middleware(request: NextRequest) {
|
export function middleware(request: NextRequest) {
|
||||||
const before = performance.now();
|
const before = Date.now();
|
||||||
const response = NextResponse.next();
|
const response = NextResponse.next();
|
||||||
|
|
||||||
// Log requests in production
|
// Log requests in production
|
||||||
if (isProduction()) {
|
if (isProduction()) {
|
||||||
console.log(
|
console.log(
|
||||||
` ${request.method} ${request.nextUrl.pathname} ${response.status} in ${(performance.now() - before).toFixed(0)}ms`
|
` ${request.method} ${request.nextUrl.pathname} ${response.status} in ${(Date.now() - before).toFixed(0)}ms`
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user