Skip to content
Merged
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
12 changes: 9 additions & 3 deletions store/api/android/store.api
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,15 @@ public final class org/mobilenativefoundation/store/store5/FetcherResult$Error$M
public fun toString ()Ljava/lang/String;
}

public abstract interface class org/mobilenativefoundation/store/store5/Logger {
public abstract fun debug (Ljava/lang/String;)V
public abstract fun error (Ljava/lang/String;Ljava/lang/Throwable;)V
}

public final class org/mobilenativefoundation/store/store5/Logger$DefaultImpls {
public static synthetic fun error$default (Lorg/mobilenativefoundation/store/store5/Logger;Ljava/lang/String;Ljava/lang/Throwable;ILjava/lang/Object;)V
}

public final class org/mobilenativefoundation/store/store5/MemoryPolicy {
public static final field Companion Lorg/mobilenativefoundation/store/store5/MemoryPolicy$Companion;
public static final field DEFAULT_SIZE_POLICY J
Expand Down Expand Up @@ -612,9 +621,6 @@ public final class org/mobilenativefoundation/store/store5/impl/extensions/Store
public static final fun get (Lorg/mobilenativefoundation/store/store5/Store;Ljava/lang/Object;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
}

public abstract interface annotation class org/mobilenativefoundation/store/store5/internal/concurrent/AnyThread : java/lang/annotation/Annotation {
}

public abstract class org/mobilenativefoundation/store/store5/internal/result/EagerConflictResolutionResult {
}

Expand Down
12 changes: 9 additions & 3 deletions store/api/jvm/store.api
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,15 @@ public final class org/mobilenativefoundation/store/store5/FetcherResult$Error$M
public fun toString ()Ljava/lang/String;
}

public abstract interface class org/mobilenativefoundation/store/store5/Logger {
public abstract fun debug (Ljava/lang/String;)V
public abstract fun error (Ljava/lang/String;Ljava/lang/Throwable;)V
}

public final class org/mobilenativefoundation/store/store5/Logger$DefaultImpls {
public static synthetic fun error$default (Lorg/mobilenativefoundation/store/store5/Logger;Ljava/lang/String;Ljava/lang/Throwable;ILjava/lang/Object;)V
}

public final class org/mobilenativefoundation/store/store5/MemoryPolicy {
public static final field Companion Lorg/mobilenativefoundation/store/store5/MemoryPolicy$Companion;
public static final field DEFAULT_SIZE_POLICY J
Expand Down Expand Up @@ -605,9 +614,6 @@ public final class org/mobilenativefoundation/store/store5/impl/extensions/Store
public static final fun get (Lorg/mobilenativefoundation/store/store5/Store;Ljava/lang/Object;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
}

public abstract interface annotation class org/mobilenativefoundation/store/store5/internal/concurrent/AnyThread : java/lang/annotation/Annotation {
}

public abstract class org/mobilenativefoundation/store/store5/internal/result/EagerConflictResolutionResult {
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package org.mobilenativefoundation.store.store5

/**
* A simple logging interface for logging error and debug messages.
*/
interface Logger {
/**
* Logs an error message, optionally with a throwable.
*
* @param message The error message to log.
* @param throwable An optional [Throwable] associated with the error.
*/
fun error(
message: String,
throwable: Throwable? = null,
)

/**
* Logs a debug message.
*
* @param message The debug message to log.
*/
fun debug(message: String)
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no info?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We're not currently using info and this component isn't currently being exposed to the consumer. There's an open request to improve logging #638. My plan is to replace this then with logging hooks delegated to the user

Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package org.mobilenativefoundation.store.store5.impl

import co.touchlab.kermit.CommonWriter
import org.mobilenativefoundation.store.store5.Logger

/**
* Default implementation of [Logger] using the Kermit logging library.
*/
internal class DefaultLogger : Logger {
private val delegate =
co.touchlab.kermit.Logger.apply {
setLogWriters(listOf(CommonWriter()))
setTag("Store")
}

override fun debug(message: String) {
delegate.d(message)
}

override fun error(
message: String,
throwable: Throwable?,
) {
delegate.e(message, throwable)

Check warning on line 24 in store/src/commonMain/kotlin/org/mobilenativefoundation/store/store5/impl/DefaultLogger.kt

View check run for this annotation

Codecov / codecov/patch

store/src/commonMain/kotlin/org/mobilenativefoundation/store/store5/impl/DefaultLogger.kt#L24

Added line #L24 was not covered by tests
}
}
Loading