- Make log process easier
- Logs with scope (and tag)
- Reduced boilerplate
- Purely written in Java
- Integrate with others Log system
As an Android developer, Timber does not have restricted scope.
- Include maven central as repository
- Choose, at least, one logger printer (
br.dev.dig.logger.printer
) and import into your project.
Simple log for Android:
dependencies {
⋮
implementation "br.dev.dig.logger.printer:android-log:${lastest_version}"
⋮
}
- Create your own
LoggerBuilder
(can be a singleton)
object MainLoggerBuilder : LoggerBuilder() {
override fun getBaseLogger(): BaseLogger {
return AndroidLogLogger()
}
}
- Get
Logger
instance:
val log = MainLoggerBuilder.logger
// OR
val log = Logger.getInstance(MainLoggerBuilder)
// With tag:
val log = MainLogger.getLogger("tag")
// OR
val log = Logger.getInstance(MainLoggerBuilder, "tag")
Can be found in folder printer
or doing some maven search for group br.dev.dig.logger.printer
.
Package | Class | Description |
---|---|---|
stub |
StubLogger |
Do nothing. |
println |
PrintLnLogger |
Use println as output. Format can be customized. |
stream |
StreamLogger |
Use OutputStream as output. Format can be customized. |
system-log |
SystemLogLogger |
Use platform native log system |
--------------- | ----------------------- | ------------- |
android-log |
AndroidLogLogger |
Use Android native Log as output. |
firebase |
FirebaseLogger |
Use Firebase Crashlytics as output (non-fatal). |
timber |
TimberLogger |
Use Timber as output. |
Some utilities that can help or improve Log operations. All of them are under group br.dev.dig.logger
(search).
Utilities are chainable. Comparing to tree structure, Printers are leafs and Utilities are branch.
Package | Class | Description |
---|---|---|
async |
AsyncLogger |
Propagate log in other Executor |
filter |
FilterLogger |
Propagate log with level above desired level |
union |
UnionLogger |
Propagate log to more than one BaseLogger |
All package has its own kotlin extension, some are just alias, but if have builder, will have extension.
- You can use and re-dist freely.
- You can also modify, but only for yourself.
- You can use it as a part of your project, but without modifications in this project.