Add query logging note

This commit is contained in:
Tim Condon 2022-07-13 13:35:47 +01:00 committed by GitHub
parent 5ba5079fdd
commit 27b8e8761d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 12 additions and 0 deletions

View File

@ -578,6 +578,18 @@ A key-path to the `@Children` relation is passed to `with` to tell Fluent to aut
]
```
## Query Logging
The Fluent drivers log the generated SQL at the debug log level. Some drivers, like FluentPostgreSQL, allow this to be configured when you configure the database.
To set the log level, in **configure.swift** (or where you set up your application) add:
```swift
app.logger.logLevel = .debug
```
This sets the log level to debug. When you next build and run your app, the SQL statements generated by Fluent will be logged to the console.
## Next steps
Congratulations on creating your first models and migrations and performing basic create and read operations. For more in-depth information on all of these features, check out their respective sections in the Fluent guide.