Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ open class DebugFormatTree : Timber.DebugTree() {

override fun createStackElementTag(element: StackTraceElement): String? {
return String.format(
"(%s:%d) %s.%s()",
element.fileName,
element.lineNumber, // format ensures line numbers have at least 3 places to align consecutive output from the same file
// method is fully qualified only when class differs on filename otherwise it can be cropped on long lambda expressions
super.createStackElementTag(element)?.replaceFirst(element.fileName.takeWhile { it != '.' }, ""),
element.methodName
"(%s:%d) %s.%s()",
element.fileName,
element.lineNumber, // format ensures line numbers have at least 3 places to align consecutive output from the same file
// method is fully qualified only when class differs on filename otherwise it can be cropped on long lambda expressions
super.createStackElementTag(element)?.replaceFirst(element.fileName.takeWhile { it != '.' }, ""),
element.methodName
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ open class FileLoggingTree(externalCacheDir: File, context: Context? = null, fil
}
}
// Don't call super, otherwise it logs twice
//super.log(priority, tag, message, t)
// super.log(priority, tag, message, t)
}

fun getFileName(): String = file.absolutePath
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ package info.hannes.timber

import timber.log.Timber

fun fileLoggingTree() = Timber.forest().filterIsInstance<FileLoggingTree>().firstOrNull()
fun fileLoggingTree() = Timber.forest().filterIsInstance<FileLoggingTree>().firstOrNull()