Make `ifValidationFails()` method support varargs of LogDetail or how can I exclude non-needed log levels from the method?
lianovann opened this issue · comments
Hello there. I use ifValidationFails()
method for logging request and response details together with logging of method
, uri
and status
. There are two methods I use to enable logging for request and response, I apply them once for all tests.
private static void enableRequestLogging(RequestSpecification requestSpecification) {
if (isDebug) {
requestSpecification
.log().all();
} else {
requestSpecification
.log().ifValidationFails()
.and().log().method()
.and().log().uri();
}
}
private static void enableResponseLogging(ValidatableResponse validatableResponse) {
if (isDebug) {
validatableResponse
.log().all();
} else {
validatableResponse
.log().ifValidationFails()
.and().log().status();
}
}
I don't want to print all request | response details if a validation is failed because some details (such as method
, uri
and status
) already printed out. I need either add headers
, params
and body
log levels to ifValidationFails()
or exclude method
, uri
and status
log levels from it.
Selecting only one log level by ifValidationFails(LogDetail logDetail)
is not enough for me. I need an option to enumerate log levels inside the method like ifValidationFails(LogDetail.HEADERS, LogDetail.PARAMS, LogDetail.BODY)
or exclude non-needed log levels.
Do we have a solution for it?