MCPcopy
hub / github.com/uber-go/zap / ServeHTTP

Method ServeHTTP

http_handler.go:71–76  ·  view source on GitHub ↗

ServeHTTP is a simple JSON endpoint that can report on or change the current logging level. # GET The GET request returns a JSON description of the current logging level like: {"level":"info"} # PUT The PUT request changes the logging level. It is perfectly safe to change the logging level whi

(w http.ResponseWriter, r *http.Request)

Source from the content-addressed store, hash-verified

69//
70// curl -X PUT localhost:8080/log/level -H "Content-Type: application/json" -d '{"level":"debug"}'
71func (lvl AtomicLevel) ServeHTTP(w http.ResponseWriter, r *http.Request) {
72 if err := lvl.serveHTTP(w, r); err != nil {
73 w.WriteHeader(http.StatusInternalServerError)
74 _, _ = fmt.Fprintf(w, "internal error: %v", err)
75 }
76}
77
78func (lvl AtomicLevel) serveHTTP(w http.ResponseWriter, r *http.Request) error {
79 type errorResponse struct {

Callers 2

FuzzAtomicLevelServeHTTPFunction · 0.95

Calls 1

serveHTTPMethod · 0.95

Tested by 2

FuzzAtomicLevelServeHTTPFunction · 0.76