middleware.Logger() has been deprecated. For request logging, use middleware.RequestLogger() or
middleware.RequestLoggerWithConfig().
middleware.RequestLogger() replaces middleware.Logger(), offering comparable configuration while relying on the
Go standard library’s new slog logger.
The previous default output format was JSON. The new default follows the standard slog logger settings.
To continue emitting request logs in JSON, configure slog accordingly:
slog.SetDefault(slog.New(slog.NewJSONHandler(os.Stdout, nil)))
e.Use(middleware.RequestLogger())If you are developing anything more substantial than a demo, use middleware.RequestLoggerWithConfig()
Security
What's Changed
- Update deps by @aldas in #2807
- refactor to use reflect.TypeFor by @cuiweixie in #2812
- Use Go 1.25 in CI by @aldas in #2810
- Modernize context.go by replacing interface{} with any by @vishr in #2822
- Fix typo in SetParamValues comment by @vishr in #2828
- Fix typo in ContextTimeout middleware comment by @vishr in #2827
- Improve BasicAuth middleware: use strings.Cut and RFC compliance by @vishr in #2825
- Fix duplicate plus operator in router backtracking logic by @yuya-morimoto in #2832
- Replace custom private IP range check with built-in net.IP.IsPrivate by @kumapower17 in #2835
- Ensure proxy connection is closed in proxyRaw function(#2837) by @kumapower17 in #2838
- Update deps by @aldas in #2843
- Logger middleware json string escaping and deprecation by @aldas in #2849
- Update golang.org/x/* deps by @aldas in #2850
- Changelog for 4.14.0 by @aldas in #2851
New Contributors
- @cuiweixie made their first contribution in #2812
- @yuya-morimoto made their first contribution in #2832
- @kumapower17 made their first contribution in #2835
Full Changelog: v4.13.4...v4.14.0