Skip to content

Fix some logging issues #242

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

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changelog

## Unreleased

* Fixed modifying severity of the global Kermit logger
* Added `PowerSync` tag for the logs
* Removed `generateLogger()` global public method meant to be used internally

## 1.4.0

* Added the ability to log PowerSync service HTTP request information via specifying a
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
package com.powersync

import BuildConfig
import co.touchlab.kermit.Logger
import co.touchlab.kermit.Severity
import co.touchlab.kermit.StaticConfig
import co.touchlab.kermit.platformLogWriter
import co.touchlab.skie.configuration.annotations.DefaultArgumentInterop
import com.powersync.db.PowerSyncDatabaseImpl
import com.powersync.db.schema.Schema
import com.powersync.utils.generateLogger
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.DelicateCoroutinesApi
import kotlinx.coroutines.GlobalScope
Expand All @@ -27,18 +30,28 @@ public fun PowerSyncDatabase(
* This parameter is ignored for iOS.
*/
dbDirectory: String? = null,
): PowerSyncDatabase {
val generatedLogger: Logger = generateLogger(logger)

return createPowerSyncDatabaseImpl(
): PowerSyncDatabase =
createPowerSyncDatabaseImpl(
schema = schema,
factory = factory,
dbFilename = dbFilename,
scope = scope,
logger = generatedLogger,
logger =
logger
?: Logger(
config = StaticConfig(
logWriterList =
listOf(platformLogWriter()),
minSeverity =
if (BuildConfig.isDebug)
Severity.Verbose
else
Severity.Warn,
),
tag = "PowerSync",
),
dbDirectory = dbDirectory,
)
}

internal fun createPowerSyncDatabaseImpl(
factory: DatabaseDriverFactory,
Expand Down
24 changes: 0 additions & 24 deletions core/src/commonMain/kotlin/com/powersync/utils/Log.kt

This file was deleted.

Loading