Skip to content

Commit

Permalink
Remove log functions from TreehousePlatform
Browse files Browse the repository at this point in the history
We have event listeners now.
  • Loading branch information
squarejesse committed May 21, 2024
1 parent 281a1d4 commit b02f433
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 30 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,22 +17,13 @@ package app.cash.redwood.treehouse

import android.content.Context
import android.content.Context.MODE_PRIVATE
import android.util.Log
import app.cash.zipline.loader.ZiplineCache
import okio.FileSystem
import okio.Path.Companion.toOkioPath

internal class AndroidTreehousePlatform(
private val context: Context,
) : TreehousePlatform {
override fun logInfo(message: String, throwable: Throwable?) {
Log.i("Zipline", message, throwable)
}

override fun logWarning(message: String, throwable: Throwable?) {
Log.w("Zipline", message, throwable)
}

/**
* Note that we don't put the ZiplineCache in Android's cacheDir.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,5 @@ package app.cash.redwood.treehouse
import app.cash.zipline.loader.ZiplineCache

internal interface TreehousePlatform {
fun logInfo(message: String, throwable: Throwable?)

fun logWarning(message: String, throwable: Throwable?)

fun newCache(name: String, maxSizeInBytes: Long): ZiplineCache
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,25 +19,8 @@ import app.cash.zipline.loader.ZiplineCache
import okio.FileSystem
import okio.Path.Companion.toPath
import platform.Foundation.NSHomeDirectory
import platform.Foundation.NSLog

internal class IosTreehousePlatform : TreehousePlatform {
override fun logInfo(message: String, throwable: Throwable?) {
if (throwable != null) {
NSLog("Treehouse: $message ${throwable.stackTraceToString()}")
} else {
NSLog("Treehouse: $message")
}
}

override fun logWarning(message: String, throwable: Throwable?) {
if (throwable != null) {
NSLog("Treehouse: $message ${throwable.stackTraceToString()}")
} else {
NSLog("Treehouse: $message")
}
}

override fun newCache(name: String, maxSizeInBytes: Long) = ZiplineCache(
fileSystem = FileSystem.SYSTEM,
directory = NSHomeDirectory().toPath() / name,
Expand Down

0 comments on commit b02f433

Please sign in to comment.