From 0ccfceb5b352c5fdb2abcb7f8d36c726854b621b Mon Sep 17 00:00:00 2001 From: celogeek Date: Sun, 30 Jan 2022 14:50:40 +0100 Subject: [PATCH] dumper --- internal/photos/api/helpers.go | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/internal/photos/api/helpers.go b/internal/photos/api/helpers.go index f6efc3d..a66f262 100644 --- a/internal/photos/api/helpers.go +++ b/internal/photos/api/helpers.go @@ -1,6 +1,8 @@ package api import ( + "bytes" + "encoding/json" "net/http" "github.com/gin-gonic/gin" @@ -17,3 +19,12 @@ func (s *Service) Recovery(c *gin.Context) { }() 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()) +}