package cn.wizzer.app.web.commons.processor;

import org.nutz.lang.Stopwatch;
import org.nutz.log.Log;
import org.nutz.log.Logs;
import org.nutz.mvc.ActionContext;
import org.nutz.mvc.impl.processor.AbstractProcessor;

import javax.servlet.http.HttpServletRequest;

/**
 * Created by Wizzer.cn on 2015/7/2.
 */
public class LogTimeProcessor extends AbstractProcessor {

    private static final Log log = Logs.get();

    public void process(ActionContext ac) throws Throwable {
        Stopwatch sw = Stopwatch.begin();
        try {
            doNext(ac);
        } finally {
            sw.stop();
            if (log.isDebugEnabled()) {
                HttpServletRequest req = ac.getRequest();
                log.debugf("[%-4s]URI=%s %sms", req.getMethod(), req.getRequestURI(), sw.getDuration());
            }
        }
    }
}

@@ -472,16 +472,56 @@
 wable %7B%0A
+        if (log.isDebugEnabled()) %7B%0A    
         
@@ -566,14 +566,22 @@
     
+    
 try %7B%0A
+    
     
@@ -608,16 +608,20 @@
         
+    
 %7D finall
@@ -636,16 +636,20 @@
         
+    
 sw.stop(
@@ -655,48 +655,8 @@
 ();%0A
-            if (log.isDebugEnabled()) %7B%0A
     
@@ -814,16 +814,16 @@
 ion());%0A
-
         
@@ -824,24 +824,65 @@
           %7D%0A
+        %7D else %7B%0A            doNext(ac);%0A
         %7D%0A  

优化一下代码..