Add remoteAddr to logs, update README.md

This commit is contained in:
Daniel Mason 2025-05-06 23:59:36 +12:00
parent 32e5408498
commit 1483171e11
Signed by: idanoo
GPG key ID: 387387CDBC02F132
2 changed files with 12 additions and 2 deletions

View file

@ -1,2 +1,11 @@
# go-http-log # go-http-log
Log all incoming HTTP requests
Extremely basic Golang HTTP server that outputs all incoming requests
### Usage
1. [Install latest version of Go.](https://go.dev/doc/install)
2. Clone this repo and simply run the main.go file
```shell
go run main.go
```

View file

@ -29,7 +29,8 @@ func main() {
body = []byte("") body = []byte("")
} }
slog.Info("Request", slog.Info("Req",
"remote", r.RemoteAddr,
"method", r.Method, "method", r.Method,
"path", r.URL.Path, "path", r.URL.Path,
"query", r.URL.RawQuery, "query", r.URL.RawQuery,