BAEL-3863 replace stdouts with logger
This commit is contained in:
parent
cf6cbe92b9
commit
6deafc178d
|
@ -5,13 +5,18 @@ import com.twitter.finagle.SimpleFilter;
|
|||
import com.twitter.finagle.http.Request;
|
||||
import com.twitter.finagle.http.Response;
|
||||
import com.twitter.util.Future;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
public class LogFilter extends SimpleFilter<Request, Response> {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(LogFilter.class);
|
||||
|
||||
@Override
|
||||
public Future<Response> apply(Request request, Service<Request, Response> service) {
|
||||
System.out.println("Request host:" + request.host().getOrElse(() -> ""));
|
||||
System.out.println("Request params:");
|
||||
request.getParams().forEach(entry -> System.out.println("\t" + entry.getKey() + " : " + entry.getValue()));
|
||||
logger.info("Request host:" + request.host().getOrElse(() -> ""));
|
||||
logger.info("Request params:");
|
||||
request.getParams().forEach(entry -> logger.info("\t" + entry.getKey() + " : " + entry.getValue()));
|
||||
return service.apply(request);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue