list by pages and rate req limits
This commit is contained in:
@ -34,6 +34,10 @@ func LogError(ctx context.Context, log *slog.Logger, msg string, attrs ...slog.A
|
||||
log.LogAttrs(ctx, slog.LevelError, msg, append(attrs, getLogFields(ctx)...)...)
|
||||
}
|
||||
|
||||
func LogWithWarnError(ctx context.Context, log *slog.Logger, err error, msg string, attrs ...slog.Attr) {
|
||||
LogWarn(ctx, log, msg, append(attrs, slog.Any("err", err))...)
|
||||
}
|
||||
|
||||
func LogWithError(ctx context.Context, log *slog.Logger, err error, msg string, attrs ...slog.Attr) {
|
||||
LogError(ctx, log, msg, append(attrs, slog.Any("err", err))...)
|
||||
}
|
||||
|
||||
15
internal/common/xcontext/wait.go
Normal file
15
internal/common/xcontext/wait.go
Normal file
@ -0,0 +1,15 @@
|
||||
package xcontext
|
||||
|
||||
import (
|
||||
"context"
|
||||
"time"
|
||||
)
|
||||
|
||||
func Wait(ctx context.Context, wait time.Duration) error {
|
||||
select {
|
||||
case <-ctx.Done():
|
||||
return ctx.Err()
|
||||
case <-time.After(wait):
|
||||
return nil
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user