package main import ( "errors" "fmt" "net/http" "kumoly.io/lib/klog" "kumoly.io/lib/ksrv" ) func main() { klog.PROD = false mux := http.NewServeMux() mux.HandleFunc("/ok", func(rw http.ResponseWriter, r *http.Request) { rw.Write([]byte("ok")) }) mux.HandleFunc("/err", func(rw http.ResponseWriter, r *http.Request) { ksrv.Abort(rw, errors.New("small err")) }) mux.HandleFunc("/panic", func(rw http.ResponseWriter, r *http.Request) { panic(500) }) mux.HandleFunc("/out", func(rw http.ResponseWriter, r *http.Request) { arr := []int{0, 1}; fmt.Print(arr[9]) }) klog.Info("start") err := ksrv.New().SetNoLogCondition(func(r *http.Request) bool { return true }).Handle(mux).Listen("127.0.0.1:8080").Serve() if err != nil { panic(err) } }