@mgcrea/fastify-request-logger
Advanced tools
Comparing version 1.5.0 to 1.6.0
@@ -23,3 +23,3 @@ // src/index.ts | ||
} else if (ignoredPath instanceof RegExp) { | ||
return ignoredPath.test(url); | ||
return ignoredPath.test(url ?? ""); | ||
} | ||
@@ -53,6 +53,7 @@ return false; | ||
} | ||
const isJson = request.headers["content-type"]?.includes("application/json"); | ||
if (request.body && logBody) { | ||
if (Buffer.isBuffer(request.body)) { | ||
request.log.debug({ ...logBindings, body: `<Buffer ${request.body.length} bytes>` }, `Request body`); | ||
} else { | ||
} else if (isJson) { | ||
request.log.debug({ ...logBindings, body: request.body }, `Request body`); | ||
@@ -59,0 +60,0 @@ } |
{ | ||
"name": "@mgcrea/fastify-request-logger", | ||
"version": "1.5.0", | ||
"version": "1.6.0", | ||
"description": "Compact request logger plugin for fastify written in TypeScript", | ||
@@ -23,3 +23,3 @@ "author": "Olivier Louvignes <olivier@mgcrea.io>", | ||
"scripts": { | ||
"start": "npm run spec -- --watch", | ||
"dev": "vitest --watch --pool=forks --reporter=verbose", | ||
"build": "tsup src/index.ts --format cjs,esm --sourcemap --dts --clean", | ||
@@ -40,16 +40,16 @@ "lint": "eslint src/ test/", | ||
"devDependencies": { | ||
"@mgcrea/eslint-config-node": "^0.9.5", | ||
"@tsconfig/node-lts": "^20.1.1", | ||
"@tsconfig/strictest": "^2.0.2", | ||
"@types/node": "^20.11.14", | ||
"eslint": "^8.56.0", | ||
"fastify": "^4.26.0", | ||
"pino": "^8.17.2", | ||
"pino-pretty": "^10.3.1", | ||
"prettier": "^3.2.4", | ||
"@mgcrea/eslint-config-node": "^0.10.1", | ||
"@tsconfig/node-lts": "^20.1.3", | ||
"@tsconfig/strictest": "^2.0.5", | ||
"@types/node": "^20.12.12", | ||
"eslint": "^8.57.0", | ||
"fastify": "^4.27.0", | ||
"pino": "^9.1.0", | ||
"pino-pretty": "^11.0.0", | ||
"prettier": "^3.2.5", | ||
"prettier-plugin-organize-imports": "^3.2.4", | ||
"rimraf": "^5.0.5", | ||
"tsup": "^8.0.1", | ||
"typescript": "^5.3.3", | ||
"vitest": "^1.2.2" | ||
"rimraf": "^5.0.7", | ||
"tsup": "^8.0.2", | ||
"typescript": "^5.4.5", | ||
"vitest": "^1.6.0" | ||
}, | ||
@@ -56,0 +56,0 @@ "dependencies": { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
25927
200