public class HttpLogOptions extends Object
Constructor and Description |
---|
HttpLogOptions()
Creates a new instance that does not log any information about HTTP requests or responses.
|
Modifier and Type | Method and Description |
---|---|
HttpLogOptions |
addAllowedHeaderName(String allowedHeaderName)
Sets the given whitelisted header to the default header set that should be logged.
|
HttpLogOptions |
addAllowedQueryParamName(String allowedQueryParamName)
Sets the given whitelisted query param that should be logged.
|
Set<String> |
getAllowedHeaderNames()
Gets the whitelisted headers that should be logged.
|
Set<String> |
getAllowedQueryParamNames()
Gets the whitelisted query parameters.
|
String |
getApplicationId()
Deprecated.
Use
ClientOptions to configure applicationId . |
HttpLogDetailLevel |
getLogLevel()
Gets the level of detail to log on HTTP messages.
|
HttpRequestLogger |
getRequestLogger()
Gets the
HttpRequestLogger that will be used to log HTTP requests. |
HttpResponseLogger |
getResponseLogger()
Gets the
HttpResponseLogger that will be used to log HTTP responses. |
boolean |
isPrettyPrintBody()
Gets flag to allow pretty printing of message bodies.
|
HttpLogOptions |
setAllowedHeaderNames(Set<String> allowedHeaderNames)
Sets the given whitelisted headers that should be logged.
|
HttpLogOptions |
setAllowedQueryParamNames(Set<String> allowedQueryParamNames)
Sets the given whitelisted query params to be displayed in the logging info.
|
HttpLogOptions |
setApplicationId(String applicationId)
Deprecated.
Use
ClientOptions to configure applicationId . |
HttpLogOptions |
setLogLevel(HttpLogDetailLevel logLevel)
Sets the level of detail to log on Http messages.
|
HttpLogOptions |
setPrettyPrintBody(boolean prettyPrintBody)
Sets flag to allow pretty printing of message bodies.
|
HttpLogOptions |
setRequestLogger(HttpRequestLogger requestLogger)
Sets the
HttpRequestLogger that will be used to log HTTP requests. |
HttpLogOptions |
setResponseLogger(HttpResponseLogger responseLogger)
Sets the
HttpResponseLogger that will be used to log HTTP responses. |
public HttpLogOptions()
public HttpLogDetailLevel getLogLevel()
HttpLogDetailLevel
.public HttpLogOptions setLogLevel(HttpLogDetailLevel logLevel)
If logLevel is not provided, default value of HttpLogDetailLevel.NONE
is set.
logLevel
- The HttpLogDetailLevel
.public Set<String> getAllowedHeaderNames()
public HttpLogOptions setAllowedHeaderNames(Set<String> allowedHeaderNames)
This method sets the provided header names to be the whitelisted header names which will be logged for all HTTP
requests and responses, overwriting any previously configured headers. Additionally, users can use HttpLogOptions.addAllowedHeaderName(String)
or HttpLogOptions.getAllowedHeaderNames()
to add or remove
more headers names to the existing set of allowed header names.
allowedHeaderNames
- The list of whitelisted header names from the user.public HttpLogOptions addAllowedHeaderName(String allowedHeaderName)
allowedHeaderName
- The whitelisted header name from the user.NullPointerException
- If allowedHeaderName
is null
.public Set<String> getAllowedQueryParamNames()
public HttpLogOptions setAllowedQueryParamNames(Set<String> allowedQueryParamNames)
allowedQueryParamNames
- The list of whitelisted query params from the user.public HttpLogOptions addAllowedQueryParamName(String allowedQueryParamName)
allowedQueryParamName
- The whitelisted query param name from the user.NullPointerException
- If allowedQueryParamName
is null
.@Deprecated public String getApplicationId()
ClientOptions
to configure applicationId
.@Deprecated public HttpLogOptions setApplicationId(String applicationId)
ClientOptions
to configure applicationId
.applicationId
- The user specified application id.IllegalArgumentException
- If applicationId
contains spaces or is larger than 24 characters in
length.public boolean isPrettyPrintBody()
public HttpLogOptions setPrettyPrintBody(boolean prettyPrintBody)
prettyPrintBody
- If true, pretty prints message bodies when logging. If the detailLevel does not include
body logging, this flag does nothing.public HttpRequestLogger getRequestLogger()
HttpRequestLogger
that will be used to log HTTP requests.
A default HttpRequestLogger
will be used if one isn't supplied.
HttpRequestLogger
that will be used to log HTTP requests.public HttpLogOptions setRequestLogger(HttpRequestLogger requestLogger)
HttpRequestLogger
that will be used to log HTTP requests.
A default HttpRequestLogger
will be used if one isn't supplied.
requestLogger
- The HttpRequestLogger
that will be used to log HTTP requests.public HttpResponseLogger getResponseLogger()
HttpResponseLogger
that will be used to log HTTP responses.
A default HttpResponseLogger
will be used if one isn't supplied.
HttpResponseLogger
that will be used to log HTTP responses.public HttpLogOptions setResponseLogger(HttpResponseLogger responseLogger)
HttpResponseLogger
that will be used to log HTTP responses.
A default HttpResponseLogger
will be used if one isn't supplied.
responseLogger
- The HttpResponseLogger
that will be used to log HTTP responses.Copyright © 2021 Microsoft Corporation. All rights reserved.