Help us shape the future of Go! Take the 2026 Go Developer Survey

http-log

command module
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 2, 2026 License: MIT Imports: 14 Imported by: 0

README

http-log

A tiny HTTP server that logs every incoming request to stdout and replies OK. Useful for inspecting webhooks, debugging clients, or seeing exactly what some tool sends over HTTP.

Install

go install github.com/Chi-teck/http-log@latest

Usage

http-log                    # listen on localhost:8888
http-log -p 9000            # listen on localhost:9000
http-log --host '' -p 9000  # listen on all interfaces
Options
Flag Default Description
-h, --host localhost Host/interface to bind to (empty = all)
-p, --port 8888 Port to listen on (0 = pick a free port)
--help Print usage

For each request, http-log prints the method, URL, protocol, remote address, sorted headers, and the body, then responds with OK. Output is colored only when stdout is a terminal and NO_COLOR is unset.

Bodies are read up to 1 MiB; anything longer is labelled truncated. Control characters in the request are replaced with printable pictures (␛, ␀, …) so that a payload cannot repaint or hijack your terminal — carriage returns are dropped, tabs and newlines are kept.

Example
$ http-log
Listening on http://127.0.0.1:8888
————————————————————————————————————————————————————————————
curl -X POST 'http://localhost:8888/hook?id=42' \
  -H 'Content-Type: application/json' \
  -d '{"event":"ping"}'
--- General ---
Date:     2026-06-25 12:00:05
Method:   POST
URL:      http://localhost:8888/hook?id=42
Protocol: HTTP/1.1
Remote:   127.0.0.1:54321

--- Headers ---
Accept:         */*
Content-Length: 16
Content-Type:   application/json
User-Agent:     curl/8.7.1

--- Body (16 bytes) ---
{"event":"ping"}
————————————————————————————————————————————————————————————

License

MIT

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL