summaryrefslogtreecommitdiff
path: root/pkg/prxy
diff options
context:
space:
mode:
authormo khan <mo@mokhan.ca>2025-03-27 11:47:58 -0600
committermo khan <mo@mokhan.ca>2025-03-27 11:47:58 -0600
commit3faa19c3aeae15070f2e143b031daaddfe296735 (patch)
treedc86e49908920c10479b9e9905c58c0c44e2cee6 /pkg/prxy
parentb08580ff78708519f0594a62531cf6ce45559265 (diff)
feat: start to add structured logging
Diffstat (limited to 'pkg/prxy')
-rw-r--r--pkg/prxy/prxy.go6
1 files changed, 3 insertions, 3 deletions
diff --git a/pkg/prxy/prxy.go b/pkg/prxy/prxy.go
index 1e378b3..809fdc1 100644
--- a/pkg/prxy/prxy.go
+++ b/pkg/prxy/prxy.go
@@ -2,13 +2,13 @@ package prxy
import (
"fmt"
- "log"
"net"
"net/http"
"net/http/httputil"
"net/url"
"github.com/xlgmokha/x/pkg/x"
+ xlog "gitlab.com/mokhax/spike/pkg/log"
)
func New(routes map[string]string) http.Handler {
@@ -21,7 +21,7 @@ func New(routes map[string]string) http.Handler {
Rewrite: func(r *httputil.ProxyRequest) {
host, _, err := net.SplitHostPort(r.In.Host)
if err != nil {
- log.Println(err)
+ xlog.WithFields(r.In, xlog.Fields{"error": err})
return
}
@@ -37,7 +37,7 @@ func New(routes map[string]string) http.Handler {
return nil
},
ErrorHandler: func(w http.ResponseWriter, r *http.Request, err error) {
- log.Println(err)
+ xlog.WithFields(r, xlog.Fields{"error": err})
},
}
}