fix(slog-fields)
- err record not found currectly ignored
This commit is contained in:
parent
02f4f1c49c
commit
a481f64abe
@ -66,12 +66,10 @@ func (l *slogLogger) Trace(ctx context.Context, begin time.Time, fc func() (sql
|
|||||||
if rows != -1 {
|
if rows != -1 {
|
||||||
fields = append(fields, slog.Int64("rows", rows))
|
fields = append(fields, slog.Int64("rows", rows))
|
||||||
}
|
}
|
||||||
if err != nil {
|
|
||||||
fields = append(fields, slog.String("error", err.Error()))
|
|
||||||
}
|
|
||||||
|
|
||||||
switch {
|
switch {
|
||||||
case err != nil && (!l.IgnoreRecordNotFoundError || !errors.Is(err, ErrRecordNotFound)):
|
case err != nil && (!l.IgnoreRecordNotFoundError || !errors.Is(err, ErrRecordNotFound)):
|
||||||
|
fields = append(fields, slog.String("error", err.Error()))
|
||||||
l.Logger.ErrorContext(ctx, "SQL executed", slog.Attr{
|
l.Logger.ErrorContext(ctx, "SQL executed", slog.Attr{
|
||||||
Key: "trace",
|
Key: "trace",
|
||||||
Value: slog.GroupValue(fields...),
|
Value: slog.GroupValue(fields...),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user