Skip to content

Commit

Permalink
...
Browse files Browse the repository at this point in the history
  • Loading branch information
MFlisar committed Oct 21, 2020
1 parent 97cf66f commit 3e02d11
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
8 changes: 5 additions & 3 deletions demo/src/main/java/com/michaelflisar/lumberjack/demo/App.kt
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
package com.michaelflisar.lumberjack.demo

import android.app.Application
import com.michaelflisar.lumberjack.FileLoggingSetup
import com.michaelflisar.lumberjack.FileLoggingTree
import android.util.Log
import com.michaelflisar.lumberjack.L
import timber.log.ConsoleTree

Expand All @@ -18,6 +17,9 @@ class App : Application() {
L.enabled = BuildConfig.DEBUG

// we can filter out logs based on caller class names like following e.g.:
// L.packageNameFilter = { packageName -> !packageName.startsWith(MainActivity::class.java.name) }
// L.packageNameFilter = {
// Log.d("PACKAGE_NAME_FILTER", "packageName = $it")
// !it.startsWith(MainActivity::class.java.name)
// }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ object L2 {
fun log(logBlock: () -> Unit) {
if (L.enabled && Timber.treeCount() > 0) {
L.callStackCorrection(4)
if (L.packageNameFilter?.let { it.invoke(StackData.create(0).className) } != false)
if (L.packageNameFilter?.let { it.invoke(StackData.create(null, 0).className) } != false)
logBlock()
}
}
Expand Down

0 comments on commit 3e02d11

Please sign in to comment.