mirror of
https://github.com/EZ-Api/ez-api.git
synced 2026-01-14 01:17: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:
@@ -2,10 +2,10 @@ package service
|
||||
|
||||
import (
|
||||
"context"
|
||||
"log/slog"
|
||||
"time"
|
||||
|
||||
"github.com/ez-api/ez-api/internal/model"
|
||||
"github.com/rs/zerolog/log"
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
@@ -47,7 +47,7 @@ func (w *LogWriter) Start(ctx context.Context) {
|
||||
return
|
||||
}
|
||||
if err := w.db.Create(&buf).Error; err != nil {
|
||||
log.Error().Err(err).Msg("log batch insert failed")
|
||||
slog.Default().Error("log batch insert failed", "err", err)
|
||||
}
|
||||
buf = buf[:0]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user