LoggerConfiguration.Builder

public static class Builder

Builder class. Allows the creation of a valid LoggerConfiguration.

Follows the Builder pattern for an easy configuration:

LoggerConfiguration mLoggerConfiguration = new LoggerConfiguration.Builder()
  .withLogLevel(LoggerConfiguration.LogLevel.FULL)
  .withThread()
  .withStackTrace(3)
  .withImprovedErrors()
  .toFile()
  .build();

Constructors

Builder

public Builder()

Builder constructor.

Methods

build

public LoggerConfiguration build()

Builds a new instance of a LoggerConfiguration using the configured parameters.

Returns

A valid LoggerConfiguration.

buildDefault

public LoggerConfiguration buildDefault()

Builds a new instance of a LoggerConfiguration using the default parameters.

Equivalent to:

LoggerConfiguration mLoggerConfiguration = new LoggerConfiguration.Builder()
  .withLogLevel(BuildConfig.DEBUG ? LogLevel.FULL : LogLevel.ERROR)
  .withStackTrace(3)
  .withThread()
  .withImprovedErrors()
  .toFile()
  .build();
Returns

A valid LoggerConfiguration.

toFile

public LoggerConfiguration.Builder toFile()

Saves log to file.

The file will be saved in Environment.getExternalStorageDirectory().toString() + "/KallistoApiLog/" separated by timestamp.

Returns

This Builder instance.

withBorder

public LoggerConfiguration.Builder withBorder()

Adds a fancy border to log messages.

Returns

This Builder instance.

withImprovedErrors

public LoggerConfiguration.Builder withImprovedErrors()

Improves visibility of log error messages.

Returns

This Builder instance.

withLogLevel

public LoggerConfiguration.Builder withLogLevel(LogLevel level)

Set the desired log level.

Only messages with with a log level higher than or equal to the configured log level will be shown.

Parameters
  • level – The desired log level. See the available log levels at LogLevel.

Returns

This Builder instance.

withStackTrace

public LoggerConfiguration.Builder withStackTrace(int i)

Appends the stacktrace information to the log message with the passed depth.

Parameters
Returns

This Builder instance.

withThread

public LoggerConfiguration.Builder withThread()

Appends the calling thread information to the log message.

Returns

This Builder instance.