Lumberjack
This is a full logging library with a build in way to log to console, file or any custom place as well as optional extensions to send a log file via mail or show it on the device.
Features#
- simply lazy evalution based logger based on a
L
class for the shortest possible log codes - easily extendible with custom loggers
- offers console and file logger implementations
- supports log filtering
- providers a viewer for log files
Screenshots#
Logs | |
---|---|
Compose Viewer | |
---|---|
Supported Platforms#
This is a KMP (kotlin multiplatform) library and the provided modules do support following platforms.
Module | Android | iOS | JVM | Info |
---|---|---|---|---|
Core | ||||
core | ✔ | ✔ | ✔ | |
Lumberjack | ||||
implementation-lumberjack | ✔ | - | ✔ | (1) |
logger-console | ✔ | - | ✔ | (2) |
logger-file | ✔ | ✔ | ✔ | |
Extensions | ||||
extension-feedback | ✔ | - | - | (3) |
extension-notification | ✔ | - | - | (3) |
extension-viewer | ✔ | - | - | (4) |
extension-composeviewer | ✔ | ✔ | ✔ | (5) |
Timber | ||||
implementation-timber | ✔ | - | - | (6) |
logger-timber-console | ✔ | - | - | (6) |
logger-timber-file | ✔ | - | - | (6) |
Note
iOS would be supported theoretically, but currently I don't know iOS and don't own an apple device - the problem is only that I can't replace ThreadLocal
and StackTraceElement
in a non jvm environment. Additionally the console logging would need an iOS implementation as well. If you know how this can be done and want to contribute, that would be much appreciated.
- (1) iOS is missing support because I don't know how to handle
ThreadLocal
andStackTraceElement
inside iOS - a pull request would be much appreciated! - (2) iOS is missing a simple console logging function - a pull request would be much appreciated!
- (3) notification and feedback module are android specific modules and therefor only support android
- (4) the viewer module is and older view based module that just supports android based on its nature
- (5) would support iOS if the iOS logger-file module is implemented
- (6) timber is only supported on android and therefor those modules are android only modules as well
Demo#
A full demo is included inside the demo module, it shows nearly every usage with working examples.
Notes#
Timber vs Lumberjack implementation#
This library fully supports Jack Whartons Timber logging library (v4!). And was even based on it until Lumberjack v6. Beginning with v6 I wrote new modules that work without timber which leads to a smaller and more versitile non timber version. I would advice you to use the non timber versions but if you want to you can simply use the timber modules I provide as well - whatever you prefer.
Why did I do this?
I decided to not use Timber
myself anymore because of following reasons:
Timber
does explicitly rely on non lazy evaluating logging - it was a decision made by Jack Wharton and was the main reason to writeLumberjack
at the beginningTimber
is restrictive regarding class extensions - in v5 I would need access to a field to continue supporting timber inLumberjack
Timber
is considered as working and feature requests and/or pull requests are not accepted if not really necessary - like e.g. my minimal one here.- additionally I always needed to extend the
BaseTree
fromTimber
because of the limiting restrictions of the defaultBaseTree
as well as it was to restrictive to make adjustment in it ( I always had a nearly 1:1 copy of it inside my library here). This was needed to allow to adjust the stack trace depth so thatLumberjack
will log the correct calling place as a wrapper aroundTimber
.
This lead to my final decision
Lumberjack
does not need Timber
and I provide a way to plug in Timber
into Lumberjack
now - this way using Timber
and Lumberjack
in combination is possible but not necessary anymore.