LoggingInterceptor Class

  • java.lang.Object
    • com.microsoft.bot.restclient.interceptors.LoggingInterceptor

Implements

okhttp3.Interceptor

public class LoggingInterceptor
implements okhttp3.Interceptor

An OkHttp interceptor that handles logging of HTTP requests and responses.

Constructor Summary

Constructor Description
LoggingInterceptor(LogLevel logLevel)

Creates an interceptor with a LogLevel enum.

Method Summary

Modifier and Type Method and Description
okhttp3.Response intercept(Interceptor.Chain chain)
protected void log(Logger logger, String s)

Process the log using an SLF4j logger and an HTTP message.

LogLevel logLevel()
LoggingInterceptor withLogLevel(LogLevel logLevel)

Sets the current logging level.

Methods inherited from java.lang.Object

java.lang.Object.clone java.lang.Object.equals java.lang.Object.finalize java.lang.Object.getClass java.lang.Object.hashCode java.lang.Object.notify java.lang.Object.notifyAll java.lang.Object.toString java.lang.Object.wait java.lang.Object.wait java.lang.Object.wait

Constructor Details

LoggingInterceptor

public LoggingInterceptor(LogLevel logLevel)

Creates an interceptor with a LogLevel enum.

Parameters:

logLevel - the level of traffic to log

Method Details

intercept

public Response intercept(Interceptor.Chain chain)

Parameters:

chain

Throws:

java.io.IOException

log

protected void log(Logger logger, String s)

Process the log using an SLF4j logger and an HTTP message.

Parameters:

logger - the SLF4j logger with the context of the request
s - the message for logging

logLevel

public LogLevel logLevel()

Returns:

the current logging level.

withLogLevel

public LoggingInterceptor withLogLevel(LogLevel logLevel)

Sets the current logging level.

Parameters:

logLevel - the new logging level

Returns:

the interceptor

Applies to