prisma-query-formatter (v1.0.1) formats Prisma query logs by substituting placeholders with actual values, supporting all databases including PostgreSQL. It handles non-standard JSON param serialization from Prisma's internal Rust engine, providing clean console output for debugging. Zero dependencies, ships TypeScript types. Released actively with minor patches. Unlike simple string replace, it correctly parses Prisma's param format and offers options like throwOnError and custom param transformers.
npm install prisma-query-formatterNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows how to set up Prisma event-based query logging with formatQuery to substitute params and print formatted queries to console.
Set throwOnError: false (default) or wrap in try/catch as shown in docs.
Do not use the formatted query to execute against database.
Use escapeWhitespace as paramTransformer to escape whitespace.
Ensure e.params is a string; default to empty string if undefined: formatQuery(e.query, e.params ?? '')
Check that e.query is the query string from Prisma event.
Set throwOnError: false or fix query/params mismatch.
No dependency data recorded yet.