mirror of
https://github.com/EZ-Api/ez-api.git
synced 2026-01-14 02:37:52 +00:00
refactor(log): migrate from zerolog to structured slog with bridge
- Replace direct zerolog usage with standard library `log/slog` in business code - Add `internal/logging` package with zerolog bridge handler for structured output - Create `internal/jsoncodec` package to centralize JSON encoding/decoding using Sonic - Update all services and main entry point to use new logging interface - Maintain backward compatibility with existing zerolog console output - Remove custom logger setup in favor of structured logging bridge
This commit is contained in:
17
internal/jsoncodec/jsoncodec.go
Normal file
17
internal/jsoncodec/jsoncodec.go
Normal file
@@ -0,0 +1,17 @@
|
||||
package jsoncodec
|
||||
|
||||
import (
|
||||
"io"
|
||||
|
||||
"github.com/bytedance/sonic"
|
||||
)
|
||||
|
||||
func Marshal(v any) ([]byte, error) { return sonic.Marshal(v) }
|
||||
|
||||
func Unmarshal(data []byte, v any) error { return sonic.Unmarshal(data, v) }
|
||||
|
||||
func UnmarshalString(data string, v any) error { return sonic.UnmarshalString(data, v) }
|
||||
|
||||
func NewEncoder(w io.Writer) sonic.Encoder { return sonic.ConfigDefault.NewEncoder(w) }
|
||||
|
||||
func NewDecoder(r io.Reader) sonic.Decoder { return sonic.ConfigDefault.NewDecoder(r) }
|
||||
Reference in New Issue
Block a user