Fasthttplogger
HTTP request logger middleware for FastHttp
Install / Use
/learn @AubSs/FasthttploggerREADME
FastHttpLogger
HTTP request logger middleware for FastHttp
Tiny / TinyColored
<method> <url> - <status> - <response-time us>
GET /hello - 200 - 11.925 us
Short / ShortColored
<remote-addr> | <HTTP/:http-version> | <method> <url> - <status> - <response-time us>
127.0.0.1:53324 | HTTP/1.1 | GET /hello - 200 - 44.8µs
Combined / CombinedColored
[<time>] <remote-addr> | <HTTP/http-version> | <method> <url> - <status> - <response-time us> | <user-agent>
[2017/05/31 - 13:27:28] 127.0.0.1:54082 | HTTP/1.1 | GET /hello - 200 - 48.279µs | Paw/3.1.1 (Macintosh; OS X/10.12.5) GCDHTTPRequest
Examples
FastHttp
func Hello(ctx *fasthttp.RequestCtx) {
fmt.Fprintf(ctx, "hello, %s!\n", ctx.UserValue("name"))
}
func main() {
m := func(ctx *fasthttp.RequestCtx) {
switch string(ctx.Path()) {
case "/hello":
Hello(ctx)
default:
ctx.Error("not found", fasthttp.StatusNotFound)
}
}
fasthttp.ListenAndServe(":8080", fasthttplogger.Tiny(m))
}
FastHttp + FastHttpRouter
func Hello(ctx *fasthttp.RequestCtx) {
fmt.Fprintf(ctx, "hello, %s!\n", ctx.UserValue("name"))
}
func main() {
router := fasthttprouter.New()
router.GET("/hello/:name", Hello)
s := &fasthttp.Server{
Handler: fasthttplogger.CombinedColored(router.Handler),
Name: "FastHttpLogger",
}
log.Fatal(s.ListenAndServe(":8080"))
}
Related Skills
node-connect
347.9kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
xurl
347.9kA CLI tool for making authenticated requests to the X (Twitter) API. Use this skill when you need to post tweets, reply, quote, search, read posts, manage followers, send DMs, upload media, or interact with any X API v2 endpoint.
frontend-design
108.7kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
347.9kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
