org.springframework.web.client.logger.HttpLogLevel Maven / Gradle / Ivy
The newest version!
package org.springframework.web.client.logger;
public enum HttpLogLevel {
/**
* No logs.
*/
NONE(0),
/**
* Logs request and response lines.
*
*
* Example:
*
*
* {@code
* --> POST /greeting http/1.1 (3-byte body)
*
* <-- 200 OK (22ms, 6-byte body)
* }
*
*/
BASIC(1),
/**
* Logs request and response lines and their respective headers.
*
*
* Example:
*
*
* {@code
* --> POST /greeting http/1.1
* Host: example.com
* Content-Type: plain/text
* Content-Length: 3
* --> END POST
*
* <-- 200 OK (22ms)
* Content-Type: plain/text
* Content-Length: 6
* <-- END HTTP
* }
*
*/
HEADERS(2),
/**
* Logs request and response lines and their respective headers and bodies (if present).
*
*
* Example:
*
*
* {@code
* --> POST /greeting http/1.1
* Host: example.com
* Content-Type: plain/text
* Content-Length: 3
*
* Hi?
* --> END POST
*
* <-- 200 OK (22ms)
* Content-Type: plain/text
* Content-Length: 6
*
* Hello!
* <-- END HTTP
* }
*
*/
BODY(3);
/**
* Level.
*/
private final int level;
private HttpLogLevel(int level) {
this.level = level;
}
public int getLevel() {
return level;
}
/**
* The current version is less than and equal to the compared version.
*
* @param level LogLevel
* @return Is it less than or equal to
*/
public boolean lte(HttpLogLevel level) {
return this.level <= level.level;
}
}