1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556 |
- package wrapper
- import (
- "database/sql"
- "net/http"
- "golang-fave/logger"
- _ "github.com/go-sql-driver/mysql"
- "github.com/vladimirok5959/golang-server-sessions/session"
- )
- type Wrapper struct {
- l *logger.Logger
- W http.ResponseWriter
- R *http.Request
- S *session.Session
- Host string
- Port string
- DConfig string
- DHtdocs string
- DLogs string
- DTemplate string
- DTmp string
- IsBackend bool
- ConfMysqlExists bool
- DB *sql.DB
- }
- func New(l *logger.Logger, w http.ResponseWriter, r *http.Request, s *session.Session, host, port, dirConfig, dirHtdocs, dirLogs, dirTemplate, dirTmp string) *Wrapper {
- return &Wrapper{
- l: l,
- W: w,
- R: r,
- S: s,
- Host: host,
- Port: port,
- DConfig: dirConfig,
- DHtdocs: dirHtdocs,
- DLogs: dirLogs,
- DTemplate: dirTemplate,
- DTmp: dirTmp,
- }
- }
- func (this *Wrapper) LogAccess(msg string) {
- this.l.Log(msg, this.R, false)
- }
- func (this *Wrapper) LogError(msg string) {
- this.l.Log(msg, this.R, true)
- }
|