
Security News
Vite Releases Technical Preview of Rolldown-Vite, a Rust-Based Bundler
Vite releases Rolldown-Vite, a Rust-based bundler preview offering faster builds and lower memory usage as a drop-in replacement for Vite.
github.com/ryandeng/accesslog
A middleware to record the access logs for http roundtrip. The recording proccess is asynchronous so you don't need to worry about big log contents will block the http roundtrip.
go get github.com/ryandeng/accesslog
nanotimestamp, method, URI, request header, request body (only for application/json), status, response body, response body (only for application/json), response length, elapsed time
func main() {
conf := &accesslog.Conf{
Filename: "./access/example.log", // the access log dir+name, dir will be generated if it doesn't exist
RequestBody: true, // whether to record request body (only for application/json)
ResponseBody: true, // whether to record response body (only for application/json)
}
mux := http.NewServeMux()
mux.HandleFunc("/abc", func(w http.ResponseWriter, req *http.Request) {
w.Header().Set("Content-type", "application/json")
resp := map[string]string{
"user": "Peter",
"position": "manager",
}
json.NewEncoder(w).Encode(resp)
})
http.ListenAndServe(":8080", accesslog.Handler(conf, mux))
}
If you are using some gracedown http framework, you can call accesslog.Flush()
to flush the contents to the disk in your gracedown procedure.
FAQs
Unknown package
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Vite releases Rolldown-Vite, a Rust-based bundler preview offering faster builds and lower memory usage as a drop-in replacement for Vite.
Research
Security News
A malicious npm typosquat uses remote commands to silently delete entire project directories after a single mistyped install.
Research
Security News
Malicious PyPI package semantic-types steals Solana private keys via transitive dependency installs using monkey patching and blockchain exfiltration.