Log

class Log

Logging.

Typically, an instance is declared at the top of a class as a private static final member:

class MyClass
{
    private static final Log LOG = new Log(MyClass.class);

    ⋮
}
Then, messages are logged by calling its appropriate methods:
if (code < 0 || code > MAX)
{
    LOG.error("Unexpected code: %d", code);
    return null;
}

Constructors

Link copied to clipboard
constructor(@NonNull scopes: Array<String>, @NonNull sink: LogSink)
constructor(@NonNull cls: Class<out Any>)
constructor(@NonNull tag: String)
constructor(@NonNull cls: Class<out Any>, @NonNull sink: LogSink)
constructor(@NonNull tag: String, @NonNull sink: LogSink)

Functions

Link copied to clipboard
open fun bug(@NonNull message: Any)
open fun bug(@NonNull location: Location, @NonNull message: Any)
Log a bug message.
open fun bug(@NonNull format: String, args: Array<Any>)
open fun bug(@NonNull location: Location, @NonNull format: String, args: Array<Any>)
Log a formatted bug message.
Link copied to clipboard
open fun debug(@NonNull message: Any)
open fun debug(@NonNull location: Location, @NonNull message: Any)
Log a debug message.
open fun debug(@NonNull format: String, args: Array<Any>)
open fun debug(@NonNull location: Location, @NonNull format: String, args: Array<Any>)
Log a formatted debug message.
Link copied to clipboard
open fun error(@NonNull message: Any)
open fun error(@NonNull location: Location, @NonNull message: Any)
Log an error message.
open fun error(@NonNull format: String, args: Array<Any>)
open fun error(@NonNull location: Location, @NonNull format: String, args: Array<Any>)
Log a formatted error message.
Link copied to clipboard
open fun fail(@NonNull message: Any)
open fun fail(@NonNull format: String, args: Array<Any>)
open fun fail(@NonNull location: Location, @NonNull format: String, args: Array<Any>)
Fail.
Link copied to clipboard
open fun getSink(): LogSink
Link copied to clipboard
Get stack trace from a throwable.
Link copied to clipboard
open fun getTag(): String
Link copied to clipboard
open fun info(@NonNull message: Any)
open fun info(@NonNull location: Location, @NonNull message: Any)
Log an info message.
open fun info(@NonNull format: String, args: Array<Any>)
open fun info(@NonNull location: Location, @NonNull format: String, args: Array<Any>)
Log a formatted info message.
Link copied to clipboard
Link copied to clipboard
open fun scopedFor(@NonNull cls: Class<out Any>): Log
open fun scopedFor(@NonNull scope: String): Log
open fun scopedFor(@NonNull cls: Class<out Any>, sink: LogSink): Log
open fun scopedFor(@NonNull scope: String, sink: LogSink): Log
Link copied to clipboard
open fun warning(@NonNull message: Any)
open fun warning(@NonNull location: Location, @NonNull message: Any)
Log a warning message.
open fun warning(@NonNull format: String, args: Array<Any>)
open fun warning(@NonNull location: Location, @NonNull format: String, args: Array<Any>)
Log a formatted warning message.