-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2041c5d
commit d13997d
Showing
14 changed files
with
361 additions
and
34 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
28 changes: 21 additions & 7 deletions
28
...org/mobilenativefoundation/storex/paging/runtime/internal/logger/impl/RealPagingLogger.kt
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,43 @@ | ||
package org.mobilenativefoundation.storex.paging.runtime.internal.logger.impl | ||
|
||
import co.touchlab.kermit.Logger | ||
import org.mobilenativefoundation.storex.paging.runtime.Identifier | ||
import org.mobilenativefoundation.storex.paging.runtime.PagingConfig | ||
import org.mobilenativefoundation.storex.paging.runtime.Severity | ||
import org.mobilenativefoundation.storex.paging.runtime.internal.logger.api.PagingLogger | ||
|
||
class RealPagingLogger<Id : Identifier<*>, K : Any>( | ||
private val pagingConfig: PagingConfig<Id, K> | ||
class RealPagingLogger( | ||
private val severity: Severity | ||
) : PagingLogger { | ||
override fun debug(message: String) { | ||
if (pagingConfig.logging.ordinal >= Severity.Debug.ordinal) { | ||
if (severity.ordinal >= Severity.Debug.ordinal) { | ||
Logger.d("storex/paging") { message } | ||
} | ||
} | ||
|
||
override fun error(message: String, error: Throwable) { | ||
if (pagingConfig.logging.ordinal >= Severity.Error.ordinal) { | ||
if (severity.ordinal >= Severity.Error.ordinal) { | ||
Logger.e("storex/paging", error) { message } | ||
} | ||
} | ||
|
||
override fun verbose(message: String) { | ||
if (pagingConfig.logging.ordinal >= Severity.Verbose.ordinal) { | ||
if (severity.ordinal >= Severity.Verbose.ordinal) { | ||
Logger.v("storex/paging") { message } | ||
} | ||
} | ||
} | ||
|
||
class TestPagingLogger : PagingLogger { | ||
override fun verbose(message: String) { | ||
println(message) | ||
} | ||
|
||
override fun debug(message: String) { | ||
println(message) | ||
} | ||
|
||
override fun error(message: String, error: Throwable) { | ||
println(message) | ||
println(error) | ||
} | ||
|
||
} |
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.