mirror of
https://github.com/appy-one/acebase.git
synced 2026-05-25 06:02:14 -06:00
[GH-ISSUE #87] Adding logging when using sqlite as storage backend? #55
Labels
No labels
IndexedDB
browser
bug
dependencies
documentation
duplicate
enhancement
feature request
indexes
indexes
invalid
pull-request
query
question
transaction logging
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: github-starred/acebase#55
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @Darkle on GitHub (Mar 19, 2022).
Original GitHub issue: https://github.com/appy-one/acebase/issues/87
Hi, when in development there are often times when I would like to log all db queries to the console. This is of course doable with the native acebase storage using the log option, but that feature isnt available when using sqlite as a storage backend.
I was wondering if it would be possible to add logging when using sqlite as a storage backend with acebase. It seems that the sqlite3 library that acebase is using supports logging the db queries via the
Database#on('trace', [callback])api mentioned here: https://github.com/mapbox/node-sqlite3/wiki/Debugging#databaseontrace-callbackI also found this thread for mysql, perhaps a logging option could be enabled for both?
Cheers.
@appy-one commented on GitHub (Mar 20, 2022):
I think it would be a nice feature to implement, but there currently is no query logging implemented. The logLevel setting works for all storage engines, but that's for console logging of internal operations. The sqlite storage engine will log other messages than default storage because it operates differently. If you are referring to transaction logging, which is only available for binary storage: that's something else. Transaction logging writes all data mutations to a separate log file to provide enhanced data synchronization and recovery options.
Long story short: there is no query logging.
What you can do though, is manually logging query stats and hints by adding a
.on('stats', stats => console.log(stats))and.on('hints', hints => console.log(hints))to your queries.