Skip to main content

Query Logging

Enable query logging to print every SQL statement IlanaORM executes, along with its execution time.

Enable only in development

Programmatically

Output

Inspect a single query

Use toSql() to get the raw SQL string without executing it:

ModelNotFoundException

findOrFail() and firstOrFail() throw a ModelNotFoundException when no record is found — instead of a generic Error. This lets you catch it specifically and return a clean 404.

toResponse() — HTTP-ready error object

Call toResponse() on the exception to get a plain { status, message } object you can pass directly to your HTTP framework:
This is especially useful in Fastify or Hono where you handle errors per route:

Global Express error handler

Catch it once across all routes:
Then in your routes, just let it throw:

Properties