log_warn.go 819 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. package main
  2. import (
  3. "fmt"
  4. "html/template"
  5. "io"
  6. "net/http"
  7. "path/filepath"
  8. )
  9. func log_warn(resp http.ResponseWriter, req *http.Request) {
  10. sess, ok := checkLogin(resp, req)
  11. if !ok {
  12. return
  13. }
  14. //视图输出
  15. files := []string{
  16. filepath.Join(Cfg.TmplDir, "log", "warn.tmpl"),
  17. filepath.Join(Cfg.TmplDir, "header.tmpl"),
  18. filepath.Join(Cfg.TmplDir, "navbar.tmpl"),
  19. }
  20. tmpl, err := template.New("warn.tmpl").Funcs(TmplFuncMap).ParseFiles(files...)
  21. if err != nil {
  22. io.WriteString(resp, fmt.Sprintf("Error: %s\n", err.Error()))
  23. } else {
  24. tmpl.Execute(resp, struct {
  25. Sess *Session
  26. Req *http.Request
  27. Title string
  28. }{
  29. sess,
  30. req,
  31. "Redis报警日志",
  32. })
  33. }
  34. }
  35. func log_warn_list(resp http.ResponseWriter, req *http.Request) {
  36. _, ok := checkLogin(resp, req)
  37. if !ok {
  38. return
  39. }
  40. }