Package com.azure.core.http.policy
Class HttpLogOptions
java.lang.Object
com.azure.core.http.policy.HttpLogOptions
The log configurations for HTTP messages.
-
Constructor Summary
ConstructorsConstructorDescriptionCreates a new instance that does not log any information about HTTP requests or responses. -
Method Summary
Modifier and TypeMethodDescriptionaddAllowedHeaderName(String allowedHeaderName) Sets the given allowed header to the default header set that should be logged.addAllowedQueryParamName(String allowedQueryParamName) Sets the given allowed query param that should be logged.Gets the allowed headers that should be logged.Gets the allowed query parameters.Deprecated.Gets the level of detail to log on HTTP messages.Gets theHttpRequestLoggerthat will be used to log HTTP requests.Gets theHttpResponseLoggerthat will be used to log HTTP responses.booleanGets flag to allow pretty printing of message bodies.setAllowedHeaderNames(Set<String> allowedHeaderNames) Sets the given allowed headers that should be logged.setAllowedQueryParamNames(Set<String> allowedQueryParamNames) Sets the given allowed query params to be displayed in the logging info.setApplicationId(String applicationId) Deprecated.UseClientOptionsto configureapplicationId.setLogLevel(HttpLogDetailLevel logLevel) Sets the level of detail to log on Http messages.setPrettyPrintBody(boolean prettyPrintBody) Sets flag to allow pretty printing of message bodies.setRequestLogger(HttpRequestLogger requestLogger) Sets theHttpRequestLoggerthat will be used to log HTTP requests.setResponseLogger(HttpResponseLogger responseLogger) Sets theHttpResponseLoggerthat will be used to log HTTP responses.
-
Constructor Details
-
HttpLogOptions
public HttpLogOptions()Creates a new instance that does not log any information about HTTP requests or responses.
-
-
Method Details
-
getLogLevel
Gets the level of detail to log on HTTP messages.- Returns:
- The
HttpLogDetailLevel.
-
setLogLevel
Sets the level of detail to log on Http messages.If logLevel is not provided, default value of
HttpLogDetailLevel.NONEis set.- Parameters:
logLevel- TheHttpLogDetailLevel.- Returns:
- The updated HttpLogOptions object.
-
getAllowedHeaderNames
Gets the allowed headers that should be logged.- Returns:
- The list of allowed headers.
-
setAllowedHeaderNames
Sets the given allowed headers that should be logged.This method sets the provided header names to be the allowed header names which will be logged for all HTTP requests and responses, overwriting any previously configured headers. Additionally, users can use
addAllowedHeaderName(String)orgetAllowedHeaderNames()to add or remove more headers names to the existing set of allowed header names.- Parameters:
allowedHeaderNames- The list of allowed header names from the user.- Returns:
- The updated HttpLogOptions object.
-
addAllowedHeaderName
Sets the given allowed header to the default header set that should be logged.- Parameters:
allowedHeaderName- The allowed header name from the user.- Returns:
- The updated HttpLogOptions object.
- Throws:
NullPointerException- IfallowedHeaderNameisnull.
-
getAllowedQueryParamNames
Gets the allowed query parameters.- Returns:
- The list of allowed query parameters.
-
setAllowedQueryParamNames
Sets the given allowed query params to be displayed in the logging info.- Parameters:
allowedQueryParamNames- The list of allowed query params from the user.- Returns:
- The updated HttpLogOptions object.
-
addAllowedQueryParamName
Sets the given allowed query param that should be logged.- Parameters:
allowedQueryParamName- The allowed query param name from the user.- Returns:
- The updated HttpLogOptions object.
- Throws:
NullPointerException- IfallowedQueryParamNameisnull.
-
getApplicationId
Deprecated.UseClientOptionsto configureapplicationId.Gets the application specific id.- Returns:
- The application specific id.
-
setApplicationId
Deprecated.UseClientOptionsto configureapplicationId.Sets the custom application specific id supplied by the user of the client library.- Parameters:
applicationId- The user specified application id.- Returns:
- The updated HttpLogOptions object.
- Throws:
IllegalArgumentException- IfapplicationIdcontains spaces or is larger than 24 characters in length.
-
isPrettyPrintBody
public boolean isPrettyPrintBody()Gets flag to allow pretty printing of message bodies.- Returns:
- true if pretty printing of message bodies is allowed.
-
setPrettyPrintBody
Sets flag to allow pretty printing of message bodies.- Parameters:
prettyPrintBody- If true, pretty prints message bodies when logging. If the detailLevel does not include body logging, this flag does nothing.- Returns:
- The updated HttpLogOptions object.
-
getRequestLogger
Gets theHttpRequestLoggerthat will be used to log HTTP requests.A default
HttpRequestLoggerwill be used if one isn't supplied.- Returns:
- The
HttpRequestLoggerthat will be used to log HTTP requests.
-
setRequestLogger
Sets theHttpRequestLoggerthat will be used to log HTTP requests.A default
HttpRequestLoggerwill be used if one isn't supplied.- Parameters:
requestLogger- TheHttpRequestLoggerthat will be used to log HTTP requests.- Returns:
- The updated HttpLogOptions object.
-
getResponseLogger
Gets theHttpResponseLoggerthat will be used to log HTTP responses.A default
HttpResponseLoggerwill be used if one isn't supplied.- Returns:
- The
HttpResponseLoggerthat will be used to log HTTP responses.
-
setResponseLogger
Sets theHttpResponseLoggerthat will be used to log HTTP responses.A default
HttpResponseLoggerwill be used if one isn't supplied.- Parameters:
responseLogger- TheHttpResponseLoggerthat will be used to log HTTP responses.- Returns:
- The updated HttpLogOptions object.
-
ClientOptionsto configureapplicationId.