Skip to content

Commit

Permalink
feat(gin): Added some log information (#63)
Browse files Browse the repository at this point in the history
Signed-off-by: Flc゛ <[email protected]>
  • Loading branch information
flc1125 authored Jan 7, 2024
1 parent 030fd3c commit 61bb19e
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions gin/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"net/http"

"github.com/gin-gonic/gin"
"github.com/go-kratos/kratos/v2/log"
)

type Server struct {
Expand Down Expand Up @@ -42,9 +43,11 @@ func NewServer(e *gin.Engine, opts ...Option) *Server {
}

func (s *Server) Start(_ context.Context) error {
log.Infof("[GIN] server listening on: %s", s.addr)
return s.server.ListenAndServe()
}

func (s *Server) Stop(ctx context.Context) error {
log.Info("[GIN] server stopping")
return s.server.Shutdown(ctx)
}

0 comments on commit 61bb19e

Please sign in to comment.