Thanks to visit codestin.com
Credit goes to github.com

Skip to content
This repository was archived by the owner on Apr 11, 2020. It is now read-only.

vicanso/elton-stats

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

elton-stats

The middleware has been archived, please use the middleware of elton.

Build Status

Route handle stats middleware for elton, it can get some information of route handle, such as status, consuming, size and etc.

package main

import (
	"bytes"
	"fmt"

	"github.com/vicanso/elton"

	stats "github.com/vicanso/elton-stats"
)

func main() {
	e := elton.New()

	e.Use(stats.New(stats.Config{
		OnStats: func(info *stats.Info, _ *elton.Context) {
			buf, _ := json.Marshal(info)
			fmt.Println(string(buf))
		},
	}))

	e.GET("/", func(c *elton.Context) (err error) {
		c.BodyBuffer = bytes.NewBufferString("abcd")
		return
	})
	err := e.ListenAndServe(":3000")
	if err != nil {
		panic(err)
	}
}

About

Stats middleware for elton.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published