format code

This commit is contained in:
jeff
2018-06-05 20:52:50 +08:00
parent 41a64c4017
commit 85d35e42ea
32 changed files with 119 additions and 276 deletions

View File

@@ -17,9 +17,10 @@ limitations under the License.
package container
import (
"strings"
"github.com/emicklei/go-restful"
"github.com/golang/glog"
"strings"
)
func logFilter() restful.FilterFunction {

View File

@@ -17,24 +17,25 @@ limitations under the License.
package route
import (
"github.com/emicklei/go-restful"
"github.com/golang/glog"
"strings"
"time"
"github.com/emicklei/go-restful"
"github.com/golang/glog"
)
// Route Filter (defines FilterFunction)
func RouteLogging(req *restful.Request, resp *restful.Response, chain *restful.FilterChain) {
start := time.Now()
chain.ProcessFilter(req, resp)
glog.Infof("%s - \"%s %s %s\" %d %dms",
strings.Split(req.Request.RemoteAddr, ":")[0],
req.Request.Method,
req.Request.URL.RequestURI(),
req.Request.Proto,
resp.StatusCode(),
time.Now().Sub(start)/1000000,
)
start := time.Now()
chain.ProcessFilter(req, resp)
glog.Infof("%s - \"%s %s %s\" %d %dms",
strings.Split(req.Request.RemoteAddr, ":")[0],
req.Request.Method,
req.Request.URL.RequestURI(),
req.Request.Proto,
resp.StatusCode(),
time.Now().Sub(start)/1000000,
)
}
}