fix: Exclude the health endpoint from being logged (#11650)
This commit is contained in:
1 parent
d9b2a73b44
commit
93dc10332d
1 file changed
+3
@@ -11,6 +11,8 @@ import { MedusaRequest, MedusaResponse } from "./types"
|
|||||||
|
|
||||||
const NOISY_ENDPOINTS_CHUNKS = ["@fs", "@id", "@vite", "@react", "node_modules"]
|
const NOISY_ENDPOINTS_CHUNKS = ["@fs", "@id", "@vite", "@react", "node_modules"]
|
||||||
|
|
||||||
|
const isHealthCheck = (req: MedusaRequest) => req.path === "/health"
|
||||||
|
|
||||||
export async function expressLoader({ app }: { app: Express }): Promise<{
|
export async function expressLoader({ app }: { app: Express }): Promise<{
|
||||||
app: Express
|
app: Express
|
||||||
shutdown: () => Promise<void>
|
shutdown: () => Promise<void>
|
||||||
@@ -69,6 +71,7 @@ export async function expressLoader({ app }: { app: Express }): Promise<{
|
|||||||
function shouldSkipHttpLog(req: MedusaRequest, res: MedusaResponse) {
|
function shouldSkipHttpLog(req: MedusaRequest, res: MedusaResponse) {
|
||||||
return (
|
return (
|
||||||
isTest ||
|
isTest ||
|
||||||
|
isHealthCheck(req) ||
|
||||||
NOISY_ENDPOINTS_CHUNKS.some((chunk) => req.url.includes(chunk)) ||
|
NOISY_ENDPOINTS_CHUNKS.some((chunk) => req.url.includes(chunk)) ||
|
||||||
!logger.shouldLog("http")
|
!logger.shouldLog("http")
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in new issue
Block a user