createTree

fun createTree(context: Context, entryMaxAge: Duration? = null, keepLatest: Long? = null, includeStackTraces: Boolean = true, filter: Shed.LogFilter = LogFilter { _, _, _, _ -> true }, scope: CoroutineScope = CoroutineScope( Dispatchers.Default + SupervisorJob() + CoroutineName(TAG) )): Timber.Tree(source)

Returns a new tree which puts all logs into a local database.

It supports clean-up operations, only running when opening the database. They are not performed at later stages to reduce runtime overhead.

Parameters

context

the context for database creation.

entryMaxAge

maximum age for log entries. Older entries will be removed when opening the database. null disables this clean-up operation. Default is null.

keepLatest

maximum amount of log entries to keep. Old entries beyond this limit will be removed when opening the database. null disables this clean-up operation. Default is null.

includeStackTraces

save stack traces in database. Default is true.

scope

the CoroutineScope to run the database inserts on.

See also