SysLog
Formats and then prints logs to the following system locations.
Android: android.util.Log.println
Jvm/AndroidUnitTest: System.out/System.err
Js/WasmJs: Console
WasmWasi: fd_write to
STDOUT_FILENO/STDERR_FILENONative:
Android: __android_log_print
Darwin/Linux/MinGW: fprintf to
stdout/stderr
NOTE: This Log implementation is meant for non-production environments. Logging to stdout/stderr in production is violence. For this reason, Debug is configured with Log.Level.Debug. If you DO happen to choose violence for your production environment, SysLog.of should be used to configure a more appropriate minimum Log.Level.
NOTE: On Android & AndroidNative API 25 and below, Logger.domain is never used and Logger.tag will be truncated (if necessary) to 23 characters.
NOTE: On Android, AndroidNative, Js/WasmJs Node, and Js/WasmJs Browser, there are log length limitations of 4_000, 1_000, 8_000, and 2_000 characters, respectively. In the event a log exceeds the maximum, SysLog will log in chunks of the maximum allowable size using the last available new line character (i.e. \r or \n) in each chunk. If no new line characters are available, then the last available whitespace is used as to not split mid-word. Lastly, if no whitespace is available, the maximum allowable length is chunked; undesirable, but highly unlikely to happen.
Except for Android & AndroidNative (Logcat has its own format), the same format is applied for all other platforms; it resembles Android Logcat almost identically. Do note that time is displayed using local time, with the caveat of WasmWasi which is in UTC and indicates so with the trailing Z character (e.g. 10-17 22:19:16.179Z).
e.g.
Log.install(SysLog.Debug)
Log.Logger.of(tag = "YourLogger").i("Hello World!")
Log.Logger.of(tag = "YourLogger2", domain = "your.domain").w("Yo!")
// 10-17 22:19:16.179 D [kmp-log:log]Log.Root: SysLog[min=Debug, max=Fatal, uid=io.matthewnelson.kmp.log.sys.SysLog].onInstall()
// 10-17 22:19:16.179 I YourLogger: Hello World!
// 10-17 22:19:16.181 W [your.domain]YourLogger2: Yo!