Skip to content

Commit 79d2552

Browse files
committed
Slightly better for security to log less in release
1 parent ec56697 commit 79d2552

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

app/src/main/kotlin/com/darkrockstudios/app/securecamera/ReleaseLogTree.kt

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,13 @@ import kotlin.math.min
77

88
class ReleaseLogTree : Timber.Tree() {
99
override fun isLoggable(tag: String?, priority: Int): Boolean {
10-
// Don't log VERBOSE or DEBUG
11-
if (priority == Log.VERBOSE || priority == Log.DEBUG) {
12-
return false
13-
}
14-
15-
// Log only ERROR, WARN and WTF, INFO
16-
return true
10+
// Only log ERROR and WTF in release builds
11+
return priority >= Log.ERROR
1712
}
1813

1914
override fun log(priority: Int, tag: String?, message: String, t: Throwable?) {
2015
if (isLoggable(tag, priority)) {
2116
// Message is short enough, doesn't need to be broken into chunks
22-
2317
if (message.length < MAX_LOG_LENGTH) {
2418
if (priority == Log.ASSERT) {
2519
Log.wtf(tag, message)

0 commit comments

Comments
 (0)