-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
It uses a modifier Timber, which allows to use a delegation logger This reverts commit 4894135. Revert "Revert "Demonstrate how to use a delegate class"" This reverts commit 379aa5b.
- Loading branch information
Showing
7 changed files
with
88 additions
and
12 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
package info.hannes.logcat | ||
|
||
import timber.log.Timber | ||
|
||
class CustomLogger : Logger { | ||
override fun v(message: String) { | ||
Timber.v(message) | ||
} | ||
|
||
override fun v(t: Throwable, message: String) { | ||
Timber.v(t, message) | ||
} | ||
|
||
override fun d(message: String) { | ||
Timber.d(message) | ||
} | ||
|
||
override fun d(t: Throwable, message: String) { | ||
Timber.d(t, message) | ||
} | ||
|
||
override fun i(message: String) { | ||
Timber.i(message) | ||
} | ||
|
||
override fun i(t: Throwable, message: String) { | ||
Timber.i(t, message) | ||
} | ||
|
||
override fun w(message: String) { | ||
Timber.w(message) | ||
} | ||
|
||
override fun w(t: Throwable, message: String) { | ||
Timber.w(t, message) | ||
} | ||
|
||
override fun e(message: String) { | ||
Timber.e(message) | ||
} | ||
|
||
override fun e(t: Throwable, message: String) { | ||
Timber.e(t, message) | ||
} | ||
|
||
override fun trace(owner: Any, message: String) { | ||
if (BuildConfig.DEBUG) { | ||
Timber.wtf(message) | ||
} | ||
} | ||
} |
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 info.hannes.logcat | ||
|
||
import org.jetbrains.annotations.NonNls | ||
|
||
interface Logger { | ||
fun v(@NonNls message: String) | ||
fun v(t: Throwable, @NonNls message: String) | ||
|
||
fun d(@NonNls message: String) | ||
fun d(t: Throwable, @NonNls message: String) | ||
|
||
fun i(@NonNls message: String) | ||
fun i(t: Throwable, @NonNls message: String) | ||
|
||
fun w(@NonNls message: String) | ||
fun w(t: Throwable, @NonNls message: String) | ||
|
||
fun e(@NonNls message: String) | ||
fun e(t: Throwable, @NonNls message: String) | ||
|
||
fun trace(owner: Any, @NonNls message: String = "") | ||
} |
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