-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Logging interface and apply log getter to that instead extension …
…function to Any. Add getLogger function to get logger if Interface is not used.
- Loading branch information
1 parent
3eb65c5
commit 280acdc
Showing
11 changed files
with
43 additions
and
35 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
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
17 changes: 0 additions & 17 deletions
17
bisqapps/shared/domain/src/commonMain/kotlin/network/bisq/mobile/utils/LogUtil.kt
This file was deleted.
Oops, something went wrong.
22 changes: 22 additions & 0 deletions
22
bisqapps/shared/domain/src/commonMain/kotlin/network/bisq/mobile/utils/Logging.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 |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package network.bisq.mobile.utils | ||
|
||
import co.touchlab.kermit.Logger | ||
|
||
private val loggerCache = mutableMapOf<String, Logger>() | ||
|
||
interface Logging { | ||
val log: Logger | ||
get() { | ||
return getLogger(this) | ||
} | ||
} | ||
|
||
fun getLogger(anyObj: Any): Logger { | ||
val tag = anyObj::class.simpleName | ||
return if (tag != null) { | ||
loggerCache.getOrPut(tag) { Logger.withTag(tag) } | ||
} else { | ||
// Anonymous classes or lambda expressions do not provide a simpleName | ||
loggerCache.getOrPut("Default") { Logger } | ||
} | ||
} |
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
6 changes: 3 additions & 3 deletions
6
...ared/presentation/src/commonMain/kotlin/network/bisq/mobile/presentation/MainPresenter.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
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