use Koin for logger
This commit is contained in:
parent
aff4b8e0ca
commit
ebc83fc535
8 changed files with 9 additions and 14 deletions
|
@ -14,6 +14,6 @@ actual fun platformModule() = module {
|
|||
|
||||
PeopleInSpaceDatabaseWrapper(PeopleInSpaceDatabase(driver))
|
||||
}
|
||||
single<Logger>{ LogcatLogger() }
|
||||
}
|
||||
|
||||
actual fun getLogger(): Logger = LogcatLogger()
|
|
@ -3,7 +3,6 @@ package com.surrus.common.di
|
|||
import co.touchlab.kermit.Kermit
|
||||
import com.surrus.common.remote.PeopleInSpaceApi
|
||||
import com.surrus.common.repository.PeopleInSpaceRepository
|
||||
import com.surrus.common.repository.getLogger
|
||||
import com.surrus.common.repository.platformModule
|
||||
import io.ktor.client.*
|
||||
import io.ktor.client.features.json.*
|
||||
|
@ -28,7 +27,7 @@ fun commonModule(enableNetworkLogs: Boolean) = module {
|
|||
single { createHttpClient(get(), enableNetworkLogs = enableNetworkLogs) }
|
||||
single { PeopleInSpaceRepository() }
|
||||
single { PeopleInSpaceApi(get()) }
|
||||
single { Kermit(getLogger()) }
|
||||
single { Kermit(logger = get()) }
|
||||
}
|
||||
|
||||
fun createJson() = Json { isLenient = true; ignoreUnknownKeys = true }
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
package com.surrus.common.repository
|
||||
|
||||
import co.touchlab.kermit.Logger
|
||||
import org.koin.core.module.Module
|
||||
|
||||
expect fun platformModule(): Module
|
||||
|
||||
expect fun getLogger(): Logger
|
|
@ -12,6 +12,5 @@ actual fun platformModule() = module {
|
|||
val driver = NativeSqliteDriver(PeopleInSpaceDatabase.Schema, "peopleinspace.db")
|
||||
PeopleInSpaceDatabaseWrapper(PeopleInSpaceDatabase(driver))
|
||||
}
|
||||
single<Logger>{ NSLogLogger() }
|
||||
}
|
||||
|
||||
actual fun getLogger(): Logger = NSLogLogger()
|
|
@ -10,6 +10,6 @@ actual fun platformModule() = module {
|
|||
single {
|
||||
PeopleInSpaceDatabaseWrapper(null)
|
||||
}
|
||||
}
|
||||
|
||||
actual fun getLogger(): Logger = CommonLogger()
|
||||
single<Logger>{ CommonLogger() }
|
||||
}
|
||||
|
|
|
@ -7,12 +7,12 @@ import com.surrus.common.di.PeopleInSpaceDatabaseWrapper
|
|||
import com.surrus.peopleinspace.db.PeopleInSpaceDatabase
|
||||
import org.koin.dsl.module
|
||||
|
||||
actual fun getLogger(): Logger = CommonLogger()
|
||||
|
||||
actual fun platformModule() = module {
|
||||
single {
|
||||
val driver = JdbcSqliteDriver(JdbcSqliteDriver.IN_MEMORY)
|
||||
.also { PeopleInSpaceDatabase.Schema.create(it) }
|
||||
PeopleInSpaceDatabaseWrapper(PeopleInSpaceDatabase(driver))
|
||||
}
|
||||
|
||||
single<Logger>{ CommonLogger() }
|
||||
}
|
|
@ -12,6 +12,6 @@ actual fun platformModule() = module {
|
|||
val driver = NativeSqliteDriver(PeopleInSpaceDatabase.Schema, "peopleinspace.db")
|
||||
PeopleInSpaceDatabaseWrapper(PeopleInSpaceDatabase(driver))
|
||||
}
|
||||
single<Logger>{ NSLogLogger() }
|
||||
}
|
||||
|
||||
actual fun getLogger(): Logger = NSLogLogger()
|
|
@ -12,7 +12,6 @@ actual fun platformModule() = module {
|
|||
val driver = NativeSqliteDriver(PeopleInSpaceDatabase.Schema, "peopleinspace.db")
|
||||
PeopleInSpaceDatabaseWrapper(PeopleInSpaceDatabase(driver))
|
||||
}
|
||||
single<Logger>{ NSLogLogger() }
|
||||
}
|
||||
|
||||
|
||||
actual fun getLogger(): Logger = NSLogLogger()
|
Loading…
Reference in a new issue