LogcatStyleLogger
Logger that mimics the Android Logcat output style using println()
.
Depending on the configuration:
If time is true, logs are formatted as:
<date> <time> <pid> <priority> <logDomain>: <message>
Example: 2023-10-05 15:30:12.451 1234 D MyApp: A debug message
If time is false, logs are formatted as:
<priority>/<logDomain>(<pid>): <message>
Example: D/MyApp(1234): A debug message
If color is true, logs are prefixed with ANSI color codes based on the log priority.
Messages at LogPriority.ERROR are treated as fatal. After logging, an exception is raised to mimic g_log
error behavior.
The time and color configurations are set when calling the install
functions and cannot be changed afterward.
Installation
This logger can be installed conditionally:
Use installOnDebuggableApp for debug builds.
Use installOnReleaseApp for release builds.
Use install to install for both debug and release builds.
Parameters
The minimum log priority to log. Default is LogPriority.DEBUG.
Whether to include timestamps in the log output. Default is true
.
Whether to include ANSI color codes in the log output. Default is true
.