ProxyLogger

public final class ProxyLogger implements Logger

Logger implementation which calls all registered Loggers when this instance log method is called.

Parameters

initialLoggers

Initial Iterable of loggers to be used by the ProxyLogger.

Constructors

Link copied to clipboard
public ProxyLogger ProxyLogger(Logger loggers)

Creates an instance of ProxyLogger using supplied loggers.

public ProxyLogger ProxyLogger(Iterable<Logger> initialLoggers)

Properties

Link copied to clipboard
private final Integer loggerCount

Returns count of currently registered Loggers.

Link copied to clipboard
private final List<Logger> loggers

Returns unmodifiable copy of registered Loggers.

Functions

Link copied to clipboard
public final Unit add(Logger logger)

Add a new logger.

public final Unit add(Logger loggers)

Add new loggers.

Link copied to clipboard
public final Unit addAll(Iterable<Logger> loggers)

Add new loggers.

Link copied to clipboard
public final Unit clear()

Remove all loggers.

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 final Integer getLoggerCount()
Link copied to clipboard
public final List<Logger> getLoggers()
Link copied to clipboard
public final Unit info(String message, Throwable throwable)

Calls Logger.log message with Info level.

Link copied to clipboard
public 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 Unit remove(Logger logger)

Remove given logger.

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.