Documentation
¶
Index ¶
- func NewSlogNoOpLogger() *slog.Logger
- func NewTeeHandler(handlers ...slog.Handler) slog.Handler
- type Gen3Logger
- func (t *Gen3Logger) Debug(msg string, args ...any)
- func (t *Gen3Logger) DebugContext(ctx context.Context, msg string, args ...any)
- func (t *Gen3Logger) DeleteFromFailedLog(path string)
- func (t *Gen3Logger) Error(msg string, args ...any)
- func (t *Gen3Logger) ErrorContext(ctx context.Context, msg string, args ...any)
- func (t *Gen3Logger) Failed(filePath, filename string, metadata common.FileMetadata, guid string, ...)
- func (t *Gen3Logger) FailedContext(ctx context.Context, filePath, filename string, metadata common.FileMetadata, ...)
- func (t *Gen3Logger) Fatal(v ...any)
- func (t *Gen3Logger) Fatalf(format string, v ...any)
- func (t *Gen3Logger) GetFailedLogMap() map[string]common.RetryObject
- func (t *Gen3Logger) GetSucceededCount() int
- func (t *Gen3Logger) GetSucceededLogMap() map[string]string
- func (t *Gen3Logger) Info(msg string, args ...any)
- func (t *Gen3Logger) InfoContext(ctx context.Context, msg string, args ...any)
- func (t *Gen3Logger) Printf(format string, v ...any)
- func (t *Gen3Logger) Println(v ...any)
- func (t *Gen3Logger) Scoreboard() *Scoreboard
- func (t *Gen3Logger) Succeeded(filePath, guid string)
- func (t *Gen3Logger) SucceededContext(ctx context.Context, filePath, guid string)
- func (t *Gen3Logger) Warn(msg string, args ...any)
- func (t *Gen3Logger) WarnContext(ctx context.Context, msg string, args ...any)
- func (t *Gen3Logger) Writer() io.Writer
- type Option
- type ProgressHandler
- type Scoreboard
- type TeeHandler
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewSlogNoOpLogger ¶
NewSlogNoOpLogger creates a no-op slog logger for testing.
Types ¶
type Gen3Logger ¶
type Gen3Logger struct {
*slog.Logger
FailedMap map[string]common.RetryObject // Maps filePath to FileMetadata
// contains filtered or unexported fields
}
--- Gen3Logger Implementation ---
func New ¶
func New(profile string, opts ...Option) (*Gen3Logger, func())
func NewGen3Logger ¶
func NewGen3Logger(logger *slog.Logger, logDir, profile string) *Gen3Logger
NewGen3Logger creates a new Gen3Logger wrapping the provided slog.Logger.
func (*Gen3Logger) Debug ¶
func (t *Gen3Logger) Debug(msg string, args ...any)
func (*Gen3Logger) DebugContext ¶
func (t *Gen3Logger) DebugContext(ctx context.Context, msg string, args ...any)
func (*Gen3Logger) DeleteFromFailedLog ¶
func (t *Gen3Logger) DeleteFromFailedLog(path string)
func (*Gen3Logger) Error ¶
func (t *Gen3Logger) Error(msg string, args ...any)
func (*Gen3Logger) ErrorContext ¶
func (t *Gen3Logger) ErrorContext(ctx context.Context, msg string, args ...any)
func (*Gen3Logger) Failed ¶
func (t *Gen3Logger) Failed(filePath, filename string, metadata common.FileMetadata, guid string, retryCount int, multipart bool)
func (*Gen3Logger) FailedContext ¶
func (t *Gen3Logger) FailedContext(ctx context.Context, filePath, filename string, metadata common.FileMetadata, guid string, retryCount int, multipart bool)
func (*Gen3Logger) Fatal ¶
func (t *Gen3Logger) Fatal(v ...any)
func (*Gen3Logger) Fatalf ¶
func (t *Gen3Logger) Fatalf(format string, v ...any)
func (*Gen3Logger) GetFailedLogMap ¶
func (t *Gen3Logger) GetFailedLogMap() map[string]common.RetryObject
func (*Gen3Logger) GetSucceededCount ¶
func (t *Gen3Logger) GetSucceededCount() int
func (*Gen3Logger) GetSucceededLogMap ¶
func (t *Gen3Logger) GetSucceededLogMap() map[string]string
func (*Gen3Logger) Info ¶
func (t *Gen3Logger) Info(msg string, args ...any)
func (*Gen3Logger) InfoContext ¶
func (t *Gen3Logger) InfoContext(ctx context.Context, msg string, args ...any)
func (*Gen3Logger) Printf ¶
func (t *Gen3Logger) Printf(format string, v ...any)
func (*Gen3Logger) Println ¶
func (t *Gen3Logger) Println(v ...any)
func (*Gen3Logger) Scoreboard ¶
func (t *Gen3Logger) Scoreboard() *Scoreboard
Scoreboard returns the embedded Scoreboard.
func (*Gen3Logger) Succeeded ¶
func (t *Gen3Logger) Succeeded(filePath, guid string)
func (*Gen3Logger) SucceededContext ¶
func (t *Gen3Logger) SucceededContext(ctx context.Context, filePath, guid string)
func (*Gen3Logger) Warn ¶
func (t *Gen3Logger) Warn(msg string, args ...any)
func (*Gen3Logger) WarnContext ¶
func (t *Gen3Logger) WarnContext(ctx context.Context, msg string, args ...any)
func (*Gen3Logger) Writer ¶
func (t *Gen3Logger) Writer() io.Writer
Writer returns os.Stderr for legacy compatibility (used by Scoreboard's tabwriter).
type Option ¶
type Option func(*config)
func WithBaseLogger ¶
func WithConsole ¶
func WithConsole() Option
func WithFailedLog ¶
func WithFailedLog() Option
func WithMessageFile ¶
func WithMessageFile() Option
func WithNoConsole ¶
func WithNoConsole() Option
func WithNoMessageFile ¶
func WithNoMessageFile() Option
func WithScoreboard ¶
func WithScoreboard() Option
func WithSucceededLog ¶
func WithSucceededLog() Option
type ProgressHandler ¶
type ProgressHandler struct {
// contains filtered or unexported fields
}
ProgressHandler is a slog.Handler that captures log messages and forwards them to a ProgressCallback if one is present in the context.
func NewProgressHandler ¶
func NewProgressHandler(next slog.Handler) *ProgressHandler
type Scoreboard ¶
type Scoreboard struct {
Counts []int // index 0 = success on first try, 1 = after 1 retry, ..., last = failed
// contains filtered or unexported fields
}
Scoreboard holds retry statistics
func NewSB ¶
func NewSB(maxRetryCount int, log *Gen3Logger) *Scoreboard
New creates a new scoreboard maxRetryCount = how many retries you allow before giving up
func (*Scoreboard) IncrementSB ¶
func (s *Scoreboard) IncrementSB(retryCount int)
Increment records a result after `retryCount` attempts retryCount == 0 → succeeded on first try retryCount == max → final failure
type TeeHandler ¶
type TeeHandler struct {
// contains filtered or unexported fields
}
TeeHandler fans out log records to multiple handlers