All Downloads are FREE. Search and download functionalities are using the official Maven repository.

restx.RestxLogLevel Maven / Gradle / Ivy

There is a newer version: 1.2.0-rc2
Show newest version
package restx;

import com.google.common.base.Stopwatch;
import org.slf4j.Logger;

/**
 * A log verbosity level for restx request / response logging.
 */
public enum RestxLogLevel {
    VERBOSE {
        public void log(Logger logger, RestxRequest restxRequest, RestxResponse restxResponse, Stopwatch stopwatch) {
            logger.info("<< {}\n{}\n>> {} - {}", restxRequest, restxRequest.getCookiesMap(), restxResponse.getStatus(), stopwatch);
        }
    },
    DEFAULT {
        public void log(Logger logger, RestxRequest restxRequest, RestxResponse restxResponse, Stopwatch stopwatch) {
            logger.info("<< {} >> {} - {}", restxRequest, restxResponse.getStatus(), stopwatch);
        }
    },
    QUIET {
        public void log(Logger logger, RestxRequest restxRequest, RestxResponse restxResponse, Stopwatch stopwatch) {
            logger.debug("<< {} >> {} - {}", restxRequest, restxResponse.getStatus(), stopwatch);
        }
    }
    ;

    public abstract void log(Logger logger, RestxRequest restxRequest, RestxResponse restxResponse, Stopwatch stopwatch);
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy