Documentation
¶
Index ¶
- func LevelFromEnv() zapcore.Level
- func LogWarning(ctx context.Context, msg string, err error)
- func With(ctx context.Context, l Logger) context.Context
- func WithFields(ctx context.Context, fields ...zap.Field) context.Context
- func WithStepCtx(ctx context.Context, name string, fn func(ctx context.Context) error) error
- func WithWarningLogger(ctx context.Context, l *WarningLogger) context.Context
- type Logger
- type OnWarningLogged
- type Step
- type StepStatus
- type WarningLogger
- type ZapLogger
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func LevelFromEnv ¶
func WithFields ¶
WithFields returns a new context with the given fields added to the logger.
func WithStepCtx ¶
func WithWarningLogger ¶
func WithWarningLogger(ctx context.Context, l *WarningLogger) context.Context
Types ¶
type Logger ¶
type Logger interface {
Debug(msg string, fields ...zapcore.Field)
Info(msg string, fields ...zapcore.Field)
Warn(msg string, fields ...zapcore.Field)
Error(msg string, fields ...zapcore.Field)
Github(msg string) // Prints only when running in GitHub Actions
With(fields ...zapcore.Field) Logger
// Scope returns a Logger with a path prefix for StartStep calls.
// Scopes can be nested: logger.Scope("A").Scope("B").StartStep("C")
// produces path ["A", "B", "C"] in the workflow tracking UI.
Scope(name string) Logger
// StartStep starts a trackable progress step.
// The step appears as "pending" until Succeed/Fail/Skip is called.
// Path is formed by: [scope prefix...] + msg
StartStep(msg string) Step
}
type OnWarningLogged ¶
type OnWarningLogged func(err error)
type Step ¶
type Step interface {
Succeed()
Fail()
Skip()
}
Step is a handle for tracking progress of an operation. Call Succeed(), Fail(), or Skip() when the operation completes.
type StepStatus ¶
type StepStatus string
StepStatus represents the outcome of a progress step.
const ( StepStatusPending StepStatus = "pending" StepStatusSuccess StepStatus = "success" StepStatusFailed StepStatus = "failed" StepStatusSkipped StepStatus = "skipped" )
type WarningLogger ¶
type WarningLogger struct {
// contains filtered or unexported fields
}
func NewWarningLogger ¶
func NewWarningLogger(validationOnly bool, onWarningLogged OnWarningLogged) *WarningLogger
func WarningLoggerFrom ¶
func WarningLoggerFrom(ctx context.Context) (*WarningLogger, bool)
func (*WarningLogger) DisableLogging ¶
func (w *WarningLogger) DisableLogging()
func (*WarningLogger) GetWarnings ¶
func (w *WarningLogger) GetWarnings() []error
func (*WarningLogger) LogWarning ¶
func (w *WarningLogger) LogWarning(ctx context.Context, msg string, err error)
type ZapLogger ¶
ZapLogger wraps zap.Logger and implements the Logger interface.
func NewLoggerFromZap ¶
Click to show internal directories.
Click to hide internal directories.