Skip to content

Commit

Permalink
feat(http/server): use logger as default debug writer
Browse files Browse the repository at this point in the history
  • Loading branch information
mgjules committed Apr 11, 2022
1 parent ff0b5eb commit 83b5730
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
2 changes: 2 additions & 0 deletions http/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ func NewServer(
gin.SetMode(gin.ReleaseMode)
}

gin.DefaultWriter = logger

s := Server{
router: gin.Default(),
addr: fmt.Sprintf("%s:%d", cfg.HttpServerHost, cfg.HttpServerPort),
Expand Down
6 changes: 6 additions & 0 deletions logger/logger.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,9 @@ func New(lc fx.Lifecycle, cfg *config.Config) (*Logger, error) {

return &Logger{otellogger.Sugar()}, nil
}

func (l *Logger) Write(p []byte) (n int, err error) {
l.Debug(string(p))

return len(p), nil
}

0 comments on commit 83b5730

Please sign in to comment.