Versions in this module Expand all Collapse all v1 v1.0.6 Feb 5, 2021 Changes in this version + var ErrGetStat = errors.New("get stat error") + var ErrPostOne = errors.New("post one error") + func BasicHello(w http.ResponseWriter, r *http.Request) + func Daemon() + func DoJsonPost(uri string, args, ret interface{}) error + func Engine() http.Handler + func InitLog(fn, prefix string) *log.Logger + func SetLog() + type AppendStruct struct + func NewAppender(fn string) (*AppendStruct, error) + func (as *AppendStruct) Close() + func (as *AppendStruct) Restart() error + func (as *AppendStruct) Write(bt []byte) (int, error) + type Cli struct + func New(url string, sec int) *Cli + func (c *Cli) Get(u string) ([]byte, error) + func (c *Cli) GetBaseURL() string + func (c *Cli) SetBaseURL(u string) + type ErrInfo struct + Err int + Msg string + type HandlerInfo struct + Handler http.HandlerFunc + Method string + type LogMux struct + func NewLogMux(fn, prefix string) *LogMux + func (l *LogMux) GET(pattern string, handler func(http.ResponseWriter, *http.Request)) + func (l *LogMux) POST(pattern string, handler func(http.ResponseWriter, *http.Request)) + func (l *LogMux) ServeHTTP(w http.ResponseWriter, r *http.Request) + type LogResponseWriter struct + func (lw *LogResponseWriter) Header() http.Header + func (lw *LogResponseWriter) Write(bt []byte) (int, error) + func (lw *LogResponseWriter) WriteHeader(statusCode int) + type MgoConfig struct + Addrs []string + Coll string + DB string + Password string + TimeoutMs int + Username string + type ReqLogDB struct + Coll mgo.Collection + Session *mgo.Session + func OpenReqLogDB(conf MgoConfig) *ReqLogDB + func (db *ReqLogDB) Close() + func (db *ReqLogDB) FindDuration(start, end time.Time) ([]RequestInfo, error) + func (db *ReqLogDB) InsertOne(ri *RequestInfo) error + type RequestInfo struct + ClientIP string + Id string + Method string + Name string + Path string + Time time.Time + func RequestToInfo(req *http.Request, t time.Time) RequestInfo + type RequestLogger struct + GetUrl string + PostUrl string + func NewRequestLogger(post, get string) *RequestLogger + func (hl *RequestLogger) GetStat(start, end time.Time) (*RequestLoggerStat, error) + func (hl *RequestLogger) PostOne(req *http.Request) error + type RequestLoggerStat struct + ClientIPCount map[string]int64 + MethodCount map[string]int64 + PathCount map[string]int64 + type ServeRequestLogger struct + Conf MgoConfig + DB *ReqLogDB + func NewServeRequestLogger(conf MgoConfig) *ServeRequestLogger + func (s *ServeRequestLogger) GetStat(start, end time.Time) (*RequestLoggerStat, error) + func (s *ServeRequestLogger) OneRequest(r *RequestInfo) error + type StatRequestInfo struct + End time.Time + Start time.Time