ConsoleLogWriter

class ConsoleLogWriter(minLevel: LogLevel = LogLevel.DEBUG, formatter: LogFormatter = LogcatLogFormatter().withColor()) : LogWriter

A LogWriter that mimics the Android Logcat output style using println().

Messages at LogLevel.ERROR are treated as fatal. After logging, an exception is raised to mimic g_log error behavior.

Installation Convenience Methods

For convenience, companion methods allow adding this writer conditionally:

Parameters

minLevel

The minimum log level to log. Default is LogLevel.DEBUG.

formatter

An optional LogFormatter to customize the log message format. Default is LogcatLogFormatter.

Constructors

Link copied to clipboard
constructor(minLevel: LogLevel = LogLevel.DEBUG, formatter: LogFormatter = LogcatLogFormatter().withColor())

Functions

Link copied to clipboard
open fun close()
Link copied to clipboard
open override fun isLoggable(level: LogLevel): Boolean

Determines if this writer is willing to handle messages with the given level.

Link copied to clipboard
open override fun write(level: LogLevel, domain: String, message: String)

Writes the log message. If isLoggable returned false, this method should ideally never be called, but if it is, it should no-op.