// Path: src/main/java/eu/codearte/resteeth/annotation/LogScope.java
// public enum LogScope {
// 
// 	NONE,
// 	INVOCATION_ONLY,
// 	FULL
// 
// }
// 
// Path: src/main/java/eu/codearte/resteeth/core/RestInvocation.java
// public class RestInvocation {
// 
// 	private final MethodMetadata metadata;
// 	private final List<RestInvocationHandler> handlers;
// 	private final Object[] arguments;
// 	private final Method method;
// 	private final HttpHeaders dynamicHeaders;
// 
// 	public RestInvocation(
// 			Method method, Object[] arguments, MethodMetadata metadata, List<RestInvocationHandler> handlers,
// 			HttpHeaders dynamicHeaders) {
// 		this.method = method;
// 		this.arguments = arguments;
// 		this.metadata = metadata;
// 		this.handlers = handlers;
// 		this.dynamicHeaders = dynamicHeaders;
// 	}
// 
// 	public Method getMethod() {
// 		return method;
// 	}
// 
// 	public Object[] getArguments() {
// 		return arguments;
// 	}
// 
// 	public MethodMetadata getMetadata() {
// 		return metadata;
// 	}
// 
// 	public HttpHeaders getDynamicHeaders() {
// 		return dynamicHeaders;
// 	}
// 
// 	public Object proceed() {
// 		return currentHandler().proceed(nextHandlers());
// 	}
// 
// 	private RestInvocationHandler currentHandler() {
// 		return handlers.get(0);
// 	}
// 
// 	private RestInvocation nextHandlers() {
// 		final List<RestInvocationHandler> withoutCurrent = handlers.subList(1, handlers.size());
// 		return new RestInvocation(method, arguments, metadata, withoutCurrent, dynamicHeaders);
// 	}
// }


import eu.codearte.resteeth.annotation.LogScope;
import eu.codearte.resteeth.core.RestInvocation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
package eu.codearte.resteeth.handlers;


/**
 * @author Tomasz Nurkiewicz
 */
public class LoggingHandler implements RestInvocationHandler {

	private static final Logger log = LoggerFactory.getLogger(LoggingHandler.class);

	@Override
	public Object proceed(RestInvocation invocation) {
		LogScope loggingScope = invocation.getMetadata().getMethodAnnotationMetadata().getResteethAnnotationMetadata().getLoggingScope();
		if (loggingScope.ordinal() >= LogScope.INVOCATION_ONLY.ordinal()) {
			log.debug("Invoked {}, calling {} {}, variables: {}",
					invocation.getMethod(),
					invocation.getMetadata().getRequestMethod(),
					invocation.getMetadata().getMethodUrl(),
					invocation.getMetadata().getParameterMetadata().getUrlVariables());
		}
		final Object result = invocation.proceed();
// Path: src/main/java/eu/codearte/resteeth/annotation/LogScope.java
// public enum LogScope {
// 
// 	NONE,
// 	INVOCATION_ONLY,
// 	FULL
// 
// }
// 
// Path: src/main/java/eu/codearte/resteeth/core/RestInvocation.java
// public class RestInvocation {
// 
// 	private final MethodMetadata metadata;
// 	private final List<RestInvocationHandler> handlers;
// 	private final Object[] arguments;
// 	private final Method method;
// 	private final HttpHeaders dynamicHeaders;
// 
// 	public RestInvocation(
// 			Method method, Object[] arguments, MethodMetadata metadata, List<RestInvocationHandler> handlers,
// 			HttpHeaders dynamicHeaders) {
// 		this.method = method;
// 		this.arguments = arguments;
// 		this.metadata = metadata;
// 		this.handlers = handlers;
// 		this.dynamicHeaders = dynamicHeaders;
// 	}
// 
// 	public Method getMethod() {
// 		return method;
// 	}
// 
// 	public Object[] getArguments() {
// 		return arguments;
// 	}
// 
// 	public MethodMetadata getMetadata() {
// 		return metadata;
// 	}
// 
// 	public HttpHeaders getDynamicHeaders() {
// 		return dynamicHeaders;
// 	}
// 
// 	public Object proceed() {
// 		return currentHandler().proceed(nextHandlers());
// 	}
// 
// 	private RestInvocationHandler currentHandler() {
// 		return handlers.get(0);
// 	}
// 
// 	private RestInvocation nextHandlers() {
// 		final List<RestInvocationHandler> withoutCurrent = handlers.subList(1, handlers.size());
// 		return new RestInvocation(method, arguments, metadata, withoutCurrent, dynamicHeaders);
// 	}
// }


// Path: src/main/java/eu/codearte/resteeth/handlers/LoggingHandler.java
import eu.codearte.resteeth.annotation.LogScope;
import eu.codearte.resteeth.core.RestInvocation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

package eu.codearte.resteeth.handlers;


/**
 * @author Tomasz Nurkiewicz
 */
public class LoggingHandler implements RestInvocationHandler {

	private static final Logger log = LoggerFactory.getLogger(LoggingHandler.class);

	@Override
	public Object proceed(RestInvocation invocation) {
		LogScope loggingScope = invocation.getMetadata().getMethodAnnotationMetadata().getResteethAnnotationMetadata().getLoggingScope();
		if (loggingScope.ordinal() >= LogScope.INVOCATION_ONLY.ordinal()) {
			log.debug("Invoked {}, calling {} {}, variables: {}",
					invocation.getMethod(),
					invocation.getMetadata().getRequestMethod(),
					invocation.getMetadata().getMethodUrl(),
					invocation.getMetadata().getParameterMetadata().getUrlVariables());
		}
		final Object result = invocation.proceed();
		if (loggingScope == LogScope.FULL) {