MCPcopy Index your code
hub / github.com/CovenantSQL/CovenantSQL / init

Function init

utils/log/debug/handler.go:26–53  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

24)
25
26func init() {
27 http.HandleFunc("/debug/covenantsql/loglevel",
28 func(w http.ResponseWriter, req *http.Request) {
29 data := map[string]interface{}{}
30 switch req.Method {
31 case http.MethodPost:
32 level := req.FormValue("level")
33 data["orig"] = log.GetLevel().String()
34 if level != "" {
35 data["want"] = level
36 lvl, err := log.ParseLevel(level)
37 if err != nil {
38 data["err"] = err.Error()
39 } else {
40 // set level
41 log.SetLevel(lvl)
42 }
43 }
44 fallthrough
45 case http.MethodGet:
46 data["level"] = log.GetLevel().String()
47 _ = json.NewEncoder(w).Encode(data)
48 default:
49 w.WriteHeader(http.StatusBadRequest)
50 }
51 },
52 )
53}

Callers

nothing calls this directly

Calls 5

GetLevelFunction · 0.92
ParseLevelFunction · 0.92
SetLevelFunction · 0.92
ErrorMethod · 0.80
StringMethod · 0.45

Tested by

no test coverage detected