This repository was archived by the owner on Apr 13, 2020. It is now read-only.
- Notifications
You must be signed in to change notification settings - Fork0
License
NotificationsYou must be signed in to change notification settings
vicanso/elton-logger
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
The middleware has been archived, please use the middleware ofelton.
Access logger for elton, it support multiple tags from request and response.
package mainimport ("bytes""fmt""github.com/vicanso/elton"codlogger"github.com/vicanso/elton-logger")funcmain() {d:=elton.New()d.Use(codlogger.New(codlogger.Config{Format:codlogger.CommonFormat,OnLog:func(strstring,_*elton.Context) {fmt.Println(str)},}))// http://127.0.0.1:7001/?_fields=foo,idd.GET("/",func(c*elton.Context) (errerror) {c.StatusCode=200c.SetHeader(elton.HeaderContentType,elton.MIMEApplicationJSON)c.BodyBuffer=bytes.NewBufferString(`{"foo": "bar","id": 1,"price": 1.21}`)return})d.ListenAndServe(":7001")}
About
No description or website provided.
Topics
Resources
License
Stars
Watchers
Forks
Packages0
No packages published