Skip to content

Commit

Permalink
Merge pull request #494 from speekha/feature/fix_android_logger_level
Browse files Browse the repository at this point in the history
Fix logger level for Android
  • Loading branch information
arnaudgiuliani committed Jun 13, 2019
2 parents 2fe4716 + ec3001a commit fcd6a63
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,20 +22,20 @@ import org.koin.core.logger.Logger
import org.koin.core.logger.MESSAGE

/**
* Logger that uses Android Log.i
* Logger that uses the native Android Logger
*
* @author - Arnaud GIULIANI
*/
class AndroidLogger(level: Level = Level.INFO) : Logger(level) {

override fun log(level: Level, msg: MESSAGE) {
if (this.level <= level) {
LogOnLevel(msg)
logOnLevel(msg, level)
}
}

private fun LogOnLevel(msg: MESSAGE) {
when (this.level) {
private fun logOnLevel(msg: MESSAGE, level: Level) {
when (level) {
Level.DEBUG -> Log.d(KOIN_TAG, msg)
Level.INFO -> Log.i(KOIN_TAG, msg)
Level.ERROR -> Log.e(KOIN_TAG, msg)
Expand Down

0 comments on commit fcd6a63

Please sign in to comment.