Skip to content

Commit

Permalink
improve logging pt2
Browse files Browse the repository at this point in the history
  • Loading branch information
cyrilevos committed Mar 27, 2024
1 parent 4e26410 commit acddbaa
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,14 @@ func NewConfig() *Config {
return false
},
ErrorHandler: func(c echo.Context, err error) error {
logger.Error().Err(err).Str("method", c.Request().Method).Str("uri", c.Request().URL.Path).Msg("proxy error")
c.Logger().Error(err)
// Log the error with additional context
logger.Error().
Err(err).
Str("method", c.Request().Method).
Str("uri", c.Request().URL.Path).
Str("ip", c.RealIP()).
Str("user_agent", c.Request().UserAgent()).
Msg("proxy error - detailed log")
return err
},
}
Expand Down

0 comments on commit acddbaa

Please sign in to comment.