comparison src/goodjava/webserver/handlers/LogHandler.java @ 1402:27efb1fcbcb5

move luan.lib to goodjava
author Franklin Schmidt <fschmidt@gmail.com>
date Tue, 17 Sep 2019 01:35:01 -0400
parents src/luan/lib/webserver/handlers/LogHandler.java@643cf1c37723
children 329197048ff0
comparison
equal deleted inserted replaced
1401:ef1620aa99cb 1402:27efb1fcbcb5
1 package goodjava.webserver.handlers;
2
3 import goodjava.logging.Logger;
4 import goodjava.logging.LoggerFactory;
5 import goodjava.webserver.Handler;
6 import goodjava.webserver.Request;
7 import goodjava.webserver.Response;
8
9
10 public final class LogHandler implements Handler {
11 private static final Logger logger = LoggerFactory.getLogger("HTTP");
12
13 private final Handler handler;
14
15 public LogHandler(Handler handler) {
16 this.handler = handler;
17 }
18
19 public Response handle(Request request) {
20 Response response = handler.handle(request);
21 logger.info( request.method + " " + request.path + " " + response.status.code + " " + response.body.length );
22 return response;
23 }
24 }