...

Source file src/github.com/redhat-developer/odo/pkg/apiserver-gen/go/logger.go

Documentation: github.com/redhat-developer/odo/pkg/apiserver-gen/go

     1  /*
     2   * odo dev
     3   *
     4   * API interface for 'odo dev'
     5   *
     6   * API version: 0.1
     7   * Generated by: OpenAPI Generator (https://openapi-generator.tech)
     8   */
     9  
    10  package openapi
    11  
    12  import (
    13  	"net/http"
    14  	"time"
    15  
    16  	"k8s.io/klog"
    17  )
    18  
    19  func Logger(inner http.Handler, name string) http.Handler {
    20  	return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
    21  		start := time.Now()
    22  
    23  		inner.ServeHTTP(w, r)
    24  
    25  		klog.V(2).Infof(
    26  			"%s %s %s %s",
    27  			r.Method,
    28  			r.RequestURI,
    29  			name,
    30  			time.Since(start),
    31  		)
    32  	})
    33  }
    34  

View as plain text