Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Logging Support #171

Merged
merged 9 commits into from
Dec 3, 2024
Merged

Logging Support #171

merged 9 commits into from
Dec 3, 2024

Conversation

cedrickcooke
Copy link
Collaborator

@cedrickcooke cedrickcooke commented Sep 5, 2024

Draft until after #170 merges, since this is going to be chock full of merge conflicts. With #170 temporarily on hold, gonna try getting this in. Sorry for the merge conflicts

Adds support for logging. Logs are leaning on the side of over-verbose (most calls log twice, once before performing the operation and again with the result). The default logger, NoOpLogger, never invokes the message lambda (and should therefore avoid most of runtime cost for running the logger).

Example output

The example output is from running the test in Sample using PrintLogger.

Database: Opening database `your-database-name` at version `1`
Database (event=upgradeneeded): Upgrading database `your-database-name` from version `0` to `1`
Transaction: Opened versionchange transaction 0
Database: Creating object store: customers
Database: Creating index: name
Database: Creating index: age
Database: Creating index: email
Database: Creating index: unnecessary_index
Database: Deleting index: unnecessary_index
Transaction (event=complete): Closed versionchange transaction 0
Database: Opened database `your-database-name`
Transaction: Opened readwrite transaction 1
Query: add request on object store `customers` (transaction 1, operation 0)
Query (event=success): add response on object store `customers` (transaction 1, operation 0)
Query: add request on object store `customers` (transaction 1, operation 1)
Query (event=success): add response on object store `customers` (transaction 1, operation 1)
Query: add request on object store `customers` (transaction 1, operation 2)
Query (event=success): add response on object store `customers` (transaction 1, operation 2)
Query: add request on object store `customers` (transaction 1, operation 3)
Query (event=success): add response on object store `customers` (transaction 1, operation 3)
Transaction (event=complete): Closed readwrite transaction 1
Transaction: Opened readonly transaction 2 using stores `customers`
Query: get request on object store `customers` (transaction 2, operation 0)
Query (event=success): get response on object store `customers` (transaction 2, operation 0)
Transaction (event=complete): Closed readonly transaction 2
Transaction: Opened readonly transaction 3 using stores `customers`
Query: get request on index `age` (transaction 3, operation 0)
Query (event=success): get response on index `age` (transaction 3, operation 0)
Transaction (event=complete): Closed readonly transaction 3
Transaction: Opened readonly transaction 4 using stores `customers`
Cursor: openCursor request on index `name` (transaction 4, operation 0)
Cursor (event=success): Cursor value on index `name` (transaction 4, operation 0)
Cursor (event=success): Cursor value on index `name` (transaction 4, operation 0)
Cursor (event=success): Cursor value on index `name` (transaction 4, operation 0)
Cursor: Cursor closed on index `name` (transaction 4, operation 0)
Transaction (event=complete): Closed readonly transaction 4
Transaction: Opened readonly transaction 5 using stores `customers`
Query: count request on object store `customers` (transaction 5, operation 0)
Query (event=success): count response on object store `customers` (transaction 5, operation 0)
Transaction (event=complete): Closed readonly transaction 5
Transaction: Opened readonly transaction 6 using stores `customers`
Query: count request on index `age` (transaction 6, operation 0)
Query (event=success): count response on index `age` (transaction 6, operation 0)
Transaction (event=complete): Closed readonly transaction 6
Transaction: Opened readonly transaction 7 using stores `customers`
Cursor: openCursor request on index `age` (transaction 7, operation 0)
Cursor (event=success): Cursor value on index `age` (transaction 7, operation 0)
Cursor (event=success): Cursor value on index `age` (transaction 7, operation 0)
Cursor: Cursor closed on index `age` (transaction 7, operation 0)
Transaction (event=complete): Closed readonly transaction 7
Transaction: Opened readonly transaction 8 using stores `customers`
Cursor: openCursor request on index `age` (transaction 8, operation 0)
Cursor (event=success): Cursor value on index `age` (transaction 8, operation 0)
Cursor (event=success): Cursor value on index `age` (transaction 8, operation 0)
Cursor: Cursor closed on index `age` (transaction 8, operation 0)
Transaction (event=complete): Closed readonly transaction 8
Database: Closing database `your-database-name` due to explicit `close()`
Database: Closed database `your-database-name`
Database: Deleting database `your-database-name`
Database (event=success): Deleted database `your-database-name`

@cedrickcooke cedrickcooke added the major Changes that should bump the MAJOR version number label Sep 5, 2024
@cedrickcooke cedrickcooke marked this pull request as ready for review November 19, 2024 18:56
@cedrickcooke cedrickcooke requested a review from a team as a code owner November 19, 2024 18:56
gradle/libs.versions.toml Outdated Show resolved Hide resolved
@cedrickcooke cedrickcooke merged commit 936706c into main Dec 3, 2024
2 checks passed
@cedrickcooke cedrickcooke deleted the cedrickc/logging branch December 3, 2024 17:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
major Changes that should bump the MAJOR version number
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants