Skip to content

Commit 37d0d9f

Browse files
feat: Enhance AppLogger with verbose logging and unconditional warning/error logging
This commit enhances the `AppLogger` utility. A new `v()` function for verbose logging has been added, which logs messages only in DEBUG builds. The `w()` and `e()` functions for warning and error logging respectively have been modified to log messages unconditionally, regardless of the build type. A new `wtf()` function has been added for logging "What a Terrible Failure" messages.
1 parent 6b354ee commit 37d0d9f

File tree

1 file changed

+12
-6
lines changed
  • app/src/main/java/com/github/droidworksstudio/common

1 file changed

+12
-6
lines changed

app/src/main/java/com/github/droidworksstudio/common/AppLogger.kt

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,12 @@ import com.github.droidworksstudio.mlauncher.BuildConfig
66
object AppLogger {
77
private const val DEFAULT_TAG = "AppLogger"
88

9+
fun v(tag: String = DEFAULT_TAG, message: String) {
10+
if (BuildConfig.DEBUG) {
11+
Log.v(tag, message)
12+
}
13+
}
14+
915
fun d(tag: String = DEFAULT_TAG, message: String) {
1016
if (BuildConfig.DEBUG) {
1117
Log.d(tag, message)
@@ -19,14 +25,14 @@ object AppLogger {
1925
}
2026

2127
fun w(tag: String = DEFAULT_TAG, message: String) {
22-
if (BuildConfig.DEBUG) {
23-
Log.w(tag, message)
24-
}
28+
Log.w(tag, message)
2529
}
2630

2731
fun e(tag: String = DEFAULT_TAG, message: String, throwable: Throwable? = null) {
28-
if (BuildConfig.DEBUG) {
29-
Log.e(tag, message, throwable)
30-
}
32+
Log.e(tag, message, throwable)
33+
}
34+
35+
fun wtf(tag: String = DEFAULT_TAG, message: String, throwable: Throwable? = null) {
36+
Log.wtf(tag, message, throwable)
3137
}
3238
}

0 commit comments

Comments
 (0)