diff --git a/bin/main.go b/bin/main.go index 720ecf9..9d835e1 100644 --- a/bin/main.go +++ b/bin/main.go @@ -56,7 +56,8 @@ func LogComponent(startTime int64, r *http.Request) { endTime := fmt.Sprintf(color, ms) method := fmt.Sprintf("\033[1;32m%s\033[0m", r.Method) // 綠色加重 url := fmt.Sprintf("\033[1;34m%s\033[0m", r.URL) // 藍色加重 - log.Println(method, url, endTime) + + log.Println(method, url, endTime, r.Header.Get("X-Forwarded-For")) } type Image struct { diff --git a/go.mod b/go.mod index e6dbb7c..61c2509 100644 --- a/go.mod +++ b/go.mod @@ -10,6 +10,7 @@ require ( github.com/elastic/go-elasticsearch/v8 v8.11.0 github.com/graphql-go/graphql v0.8.1 github.com/graphql-go/handler v0.2.3 + github.com/hashicorp/golang-lru/v2 v2.0.7 github.com/jmoiron/sqlx v1.3.5 github.com/milvus-io/milvus-sdk-go/v2 v2.2.1 github.com/mitchellh/mapstructure v1.5.0 @@ -31,7 +32,6 @@ require ( github.com/fsnotify/fsnotify v1.6.0 // indirect github.com/golang/protobuf v1.5.2 // indirect github.com/grpc-ecosystem/go-grpc-middleware v1.3.0 // indirect - github.com/hashicorp/golang-lru/v2 v2.0.7 // indirect github.com/hashicorp/hcl v1.0.0 // indirect github.com/json-iterator/go v1.1.12 // indirect github.com/magiconair/properties v1.8.7 // indirect