ConsoleQueryLogger class
A query logger that prints to the console.
Useful for development and debugging. Shows SQL, parameters, and timing.
Example output:
[findMany] Starting: SELECT * FROM "User" WHERE "email" = $1
[findMany] [15ms] SELECT * FROM "User" WHERE "email" = $1 → 1 row
- Implemented types
Constructors
- ConsoleQueryLogger({bool includeParameters = false, bool includeSql = true, Duration threshold = Duration.zero, bool colorize = true})
-
const
Properties
- colorize → bool
-
Whether to colorize output (ANSI escape codes)
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- includeParameters → bool
-
Whether to include parameters in the output (may contain sensitive data)
final
- includeSql → bool
-
Whether to include the SQL query in the output
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- threshold → Duration
-
Minimum duration to log (queries faster than this are not logged)
Set to Duration.zero to log all queries.
final
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
onQueryEnd(
QueryEndEvent event) → void -
Called after a query completes successfully.
override
-
onQueryError(
QueryErrorEvent event) → void -
Called when a query fails.
override
-
onQueryStart(
QueryStartEvent event) → void -
Called before a query is executed.
override
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited