arch-lumber

//Lumber/br.com.arch.toolkit.lumber/Lumber/Oak

Oak

abstract class Oak

Oak

An Oak represents a single logging destination.

Extend this abstract class to create a custom logger, whether it sends logs to the console, a file, a remote server, or an analytics service.

Implementing a Custom Oak

You need to implement two methods:

Example

class ConsoleOak : Lumber.Oak() {
    override fun isLoggable(tag: String?, level: Level) = true

    override fun log(level: Level, tag: String?, message: String, error: Throwable?) {
        println("[$level] ${tag?.let { "($it) " } ?: ""} - $message")
        error?.printStackTrace()
    }
}

// Plant it
Lumber.plant(ConsoleOak())

See also

 
Lumber.OakWood
DebugOak

Inheritors

 
OakWood
DebugOak

Constructors

   
Oak [common]
constructor()

Functions

Name Summary
debug [common]
open fun debug(error: Throwable)
Logs a Debug error.
[common]
open fun debug(message: String, vararg args: Any?)
Logs a Debug message.
[common]
open fun debug(error: Throwable, message: String, vararg args: Any?)
Logs a Debug error with a message.
error [common]
open fun error(error: Throwable)
Logs an Error error.
[common]
open fun error(message: String, vararg args: Any?)
Logs an Error message.
[common]
open fun error(error: Throwable, message: String, vararg args: Any?)
Logs an Error error with a message.
info [common]
open fun info(error: Throwable)
Logs an Info error.
[common]
open fun info(message: String, vararg args: Any?)
Logs an Info message.
[common]
open fun info(error: Throwable, message: String, vararg args: Any?)
Logs an Info error with a message.
isLoggable [common]
abstract fun isLoggable(tag: String?, level: Lumber.Level): Boolean
Determines whether a message should be logged.
log [common]
open fun log(level: Lumber.Level, error: Throwable)
Logs an error with a specific Level.
[common]
open fun log(level: Lumber.Level, message: String, vararg args: Any?)
Logs a message with a specific Level and optional arguments.
[common]
open fun log(level: Lumber.Level, error: Throwable?, message: String?, vararg args: Any?)
The most generic log method, handling all parameters.
maxLogLength [common]
open fun maxLogLength(length: Int): Lumber.Oak
Sets a one-time maximum length for the next log message.
maxTagLength [common]
open fun maxTagLength(length: Int): Lumber.Oak
Sets a one-time maximum length for the tag on the next log message.
quiet [common]
open fun quiet(quiet: Boolean): Lumber.Oak
Suppresses the next log message for this Oak.
tag [common]
open fun tag(tag: String): Lumber.Oak
Sets a one-time tag for the next log message.
verbose [common]
open fun verbose(error: Throwable)
Logs a Verbose error.
[common]
open fun verbose(message: String, vararg args: Any?)
Logs a Verbose message.
[common]
open fun verbose(error: Throwable, message: String, vararg args: Any?)
Logs a Verbose error with a message.
warn [common]
open fun warn(error: Throwable)
Logs a Warn error.
[common]
open fun warn(message: String, vararg args: Any?)
Logs a Warn message.
[common]
open fun warn(error: Throwable, message: String, vararg args: Any?)
Logs a Warn error with a message.
wtf [common]
open fun wtf(error: Throwable)
Logs an Assert error.
[common]
open fun wtf(message: String, vararg args: Any?)
Logs an Assert message.
[common]
open fun wtf(error: Throwable, message: String, vararg args: Any?)
Logs an Assert error with a message.