Introduce logging adapter for jobqueue

This commit is contained in:
Lukas Zapletal 2022-06-29 15:49:19 +02:00 committed by Ondřej Budai
parent c43b4992fe
commit a8afca4634
5 changed files with 166 additions and 18 deletions

View file

@ -79,6 +79,18 @@ type JobQueue interface {
RefreshHeartbeat(token uuid.UUID)
}
// SimpleLogger provides a structured logging methods for the jobqueue library.
type SimpleLogger interface {
// Info creates an info-level message and arbitrary amount of key-value string pairs which
// can be optionally mapped to fields by underlying implementations.
Info(msg string, args ...string)
// Error creates an error-level message and arbitrary amount of key-value string pairs which
// can be optionally mapped to fields by underlying implementations. The first error argument
// can be set to nil when no context error is available.
Error(err error, msg string, args ...string)
}
var (
ErrNotExist = errors.New("job does not exist")
ErrNotPending = errors.New("job is not pending")