Chapters
00:00 - Querying A Course's Modules
02:06 - Providing the Modules to our Page
02:30 - Deep Cloning our Modules with structuredClone
03:44 - Displaying the Course's Module & Lesson Counts
04:50 - Listing the Course's Modules Using VueDraggable
10:32 - Implementing our SortableModules Component
10:52 - Adding A Module To Test Our List Using Node REPL
12:12 - A Hydration Mismatch Note for Vue 3.4 & Shadcn-Vue
13:25 - Adding Lessons to our ModuleDto
Join The Discussion! (4 Comments)
Please sign in or sign up for free to join in on the dicussion.
rajeeb-shakya
How can i log the query to check if i am writing query correct or not?
console.log(query.toSQL())
is not working for me. Any way that i can log query and check in storage/logs/adonis.log?
Please sign in or sign up for free to reply
tomgobich
Hi Rajeeb!
Console logging a call to
toSQL()
as you have should work, you should be seeing something like the below in your console.However, there is a nicer way to do this, using pretty printed query logging. Within your
config/database.ts
, setprettyPrintDebugQueries: true
.Then, you can either globally enable query logging, by adding a
debug: true
to your driver object.Or, you can enable this this on a per-query basis by adding
debug(true)
to the query.With that set, you should see something like below in your console
Now, unfortunately, this pretty print can't be logged to a file. You can still log the query to a file though. Within your
config/logger
, set the non-production logger target to a file at the destination you'd like. If that's a file in storage, it'd look something like:Then, add a global listener for the query within a preload.
With this all your logs, including queries, will be written to the file at the location you've specified! Hope this helps!! 😊
Please sign in or sign up for free to reply
rajeeb-shakya
Thanks Tom. Thats what i am seeking for. I will find way to print those queries in log file.
thanks
Please sign in or sign up for free to reply
tomgobich
Anytime! Okay cool, yeah updating the logger destination and logging the queries, as shown in the last two code blocks in my comment above, should get that working for ya!
Please sign in or sign up for free to reply