package main import ( "fmt" "html/template" "io" "net/http" "path/filepath" ) func log_warn(resp http.ResponseWriter, req *http.Request) { sess, ok := checkLogin(resp, req) if !ok { return } //视图输出 files := []string{ filepath.Join(Cfg.TmplDir, "log", "warn.tmpl"), filepath.Join(Cfg.TmplDir, "header.tmpl"), filepath.Join(Cfg.TmplDir, "navbar.tmpl"), } tmpl, err := template.New("warn.tmpl").Funcs(TmplFuncMap).ParseFiles(files...) if err != nil { io.WriteString(resp, fmt.Sprintf("Error: %s\n", err.Error())) } else { tmpl.Execute(resp, struct { Sess *Session Req *http.Request Title string }{ sess, req, "Redis报警日志", }) } } func log_warn_list(resp http.ResponseWriter, req *http.Request) { _, ok := checkLogin(resp, req) if !ok { return } }