dumper
This commit is contained in:
parent
87ee1cc6c6
commit
0ccfceb5b3
@ -1,6 +1,8 @@
|
|||||||
package api
|
package api
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"bytes"
|
||||||
|
"encoding/json"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
@ -17,3 +19,12 @@ func (s *Service) Recovery(c *gin.Context) {
|
|||||||
}()
|
}()
|
||||||
c.Next()
|
c.Next()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (s *Service) Dump(o interface{}) {
|
||||||
|
b := bytes.NewBuffer([]byte{})
|
||||||
|
enc := json.NewEncoder(b)
|
||||||
|
enc.SetIndent("", " ")
|
||||||
|
enc.Encode(o)
|
||||||
|
|
||||||
|
s.Logger.Printf("%s", b.Bytes())
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user