mirror of
https://github.com/idanoo/go-http-log
synced 2025-07-01 05:42:15 +00:00
Add remoteAddr to logs, update README.md
This commit is contained in:
parent
32e5408498
commit
1483171e11
2 changed files with 12 additions and 2 deletions
11
README.md
11
README.md
|
@ -1,2 +1,11 @@
|
|||
# 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
|
||||
```
|
||||
|
|
3
main.go
3
main.go
|
@ -29,7 +29,8 @@ func main() {
|
|||
body = []byte("")
|
||||
}
|
||||
|
||||
slog.Info("Request",
|
||||
slog.Info("Req",
|
||||
"remote", r.RemoteAddr,
|
||||
"method", r.Method,
|
||||
"path", r.URL.Path,
|
||||
"query", r.URL.RawQuery,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue