wrapper.go 768 B

12345678910111213141516171819202122232425262728293031323334353637
  1. package wrapper
  2. import (
  3. "net/http"
  4. "golang-fave/logger"
  5. "github.com/vladimirok5959/golang-server-sessions/session"
  6. )
  7. type Wrapper struct {
  8. l *logger.Logger
  9. W http.ResponseWriter
  10. R *http.Request
  11. S *session.Session
  12. Host string
  13. Port string
  14. DConfig string
  15. DHtdocs string
  16. DLogs string
  17. DTemplate string
  18. DTmp string
  19. }
  20. func New(l *logger.Logger, w http.ResponseWriter, r *http.Request, s *session.Session, host, port, dirConfig, dirHtdocs, dirLogs, dirTemplate, dirTmp string) *Wrapper {
  21. return &Wrapper{l, w, r, s, host, port, dirConfig, dirHtdocs, dirLogs, dirTemplate, dirTmp}
  22. }
  23. func (this *Wrapper) LogAccess(msg string) {
  24. this.l.Log(msg, this.R, false)
  25. }
  26. func (this *Wrapper) LogError(msg string) {
  27. this.l.Log(msg, this.R, true)
  28. }