LoggerScope

public interface LoggerScope implements Logger

Wrapper for Logger which prepends each logged message with the scope.

Types

Link copied to clipboard
public class Companion

Functions

Link copied to clipboard
public final Unit debug(String message, Throwable throwable)

Calls Logger.log message with Debug level.

Link copied to clipboard
public final T duration<T extends Any>(Function0<T> body)

Measures the duration it takes to invoke the body. Logs with Verbose level message Started before the invocation and Finished took XYZms after completion.

Link copied to clipboard
public final Unit error(String message, Throwable throwable)

Calls Logger.log message with Error level.

Link copied to clipboard
public abstract Logger getIdentity()

The wrapped Logger.

Link copied to clipboard
public abstract String getScope()

Description of the scope, usually a class name or a custom name.

Link copied to clipboard
public final Unit info(String message, Throwable throwable)

Calls Logger.log message with Info level.

Link copied to clipboard
public abstract Unit log(Level level, String message, Throwable throwable)

Uses level to determine whether it should be passed to the underlying implementation. Implementations are free to use whichever level they like.

Link copied to clipboard
public final T scope<T extends Any>(String name, Function1<LoggerScope, T> body)

Creates temporary sub-scope of current LoggerScope with custom name post-fixed to the new scope. The sub-scope is discarded once the body invocation is finished.

Link copied to clipboard
public final T timedScope<T extends Any>(String name, Function0<T> body)

Measures the duration of a scope.

Link copied to clipboard
public final Unit verbose(String message, Throwable throwable)

Calls Logger.log message with Verbose level.

Link copied to clipboard
public final Unit warning(String message, Throwable throwable)

Calls Logger.log message with Warning level.