Remove js-logger dependency#966
Draft
simolus3 wants to merge 15 commits into
Draft
Conversation
🦋 Changeset detectedLatest commit: 2b898c3 The changes in this PR will be included in the next version bump. This PR includes changesets to release 16 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
rkistner
reviewed
May 18, 2026
| if (options.logLevel) { | ||
| logger.setLevel(options.logLevel); | ||
| } | ||
| export function createPowerSyncLogger(options?: Partial<CreateLoggerOptions>): PowerSyncLogger & CreateLoggerOptions { |
Contributor
There was a problem hiding this comment.
Would createConsoleLogger perhaps be a better description here?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
As proposed in #948, this removes the
js-loggerdependency in favor of a custom logging interface. The idea is that:levelas a named parameter instead of one method per level) to keep the interface smaller.createBaseLogger. If you want a PowerSync database to log, you pass a logger in. By default, we use an implementation forwarding logs toconsole.log.For the most part, users can keep using the default option and continue to get a default out-of-the-box experience where messages with level
infoand higher are logged to the console with a[PowerSync]prefix. To customize this:PowerSyncLoggerinterface, and pass an instance of that toPowerSyncDatabase. Or, if you want the default logger but with another minimum severity, usecreatePowerSyncLogger.WASQLiteOpenFactorydirectly, one also needs to pass a logger. The web SDK would forward the one from the database by default.logLevelcan be passed toWASQLiteOpenFactory, and messages with that level or higher are forwarded to the main tab.This is a breaking change, which is why this PR has the
v2branch as a target. The idea is to bundle up changes which we can then release at once.