zero-contrib
zero-contrib copied to clipboard
integrate Slog into logx
#325
Greptile Summary
This pull request integrates the new log/slog package from Go 1.21 into the logx module of the zero-contrib project, implementing a SlogWriter struct in logx/slogx/slog.go to adapt the logx.Writer interface for slog usage.
- Replaced fmt.Sprint with fmt.Sprintf in
logx/slogx/slog.go
for consistent formatting across all types in log messages - Optimized
toSlogFields
function to create a single slice for all fields, improving efficiency - Implemented
SlogWriter
struct with methods for various log levels (Debug, Error, Info, etc.) using slog - Added
NewSlogWriter
function to create a newlogx.Writer
instance using slog.Handler