contextutils

package
v0.25.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 16, 2024 License: Apache-2.0 Imports: 8 Imported by: 195

Documentation

Index

Constants

View Source
const (
	LogLevelEnvName          = "LOG_LEVEL"
	LogToFileLocationEnvName = "LOG_TO_FILE_LOCATION"
)

Variables

This section is empty.

Functions

func CliLogErrorw

func CliLogErrorw(ctx context.Context, message string, keysAndValues ...interface{})

func CliLogInfow

func CliLogInfow(ctx context.Context, message string, keysAndValues ...interface{})

func CliLogWarnw

func CliLogWarnw(ctx context.Context, message string, keysAndValues ...interface{})

func GetLogHandler added in v0.21.27

func GetLogHandler() zap.AtomicLevel

func GetLogLevel

func GetLogLevel() zapcore.Level

func LoggerFrom

func LoggerFrom(ctx context.Context) *zap.SugaredLogger

func SetFallbackLogger

func SetFallbackLogger(logger *zap.SugaredLogger)

func SetLogLevel

func SetLogLevel(l zapcore.Level)

func SetLogLevelFromString added in v0.21.27

func SetLogLevelFromString(logLevel string)

func SilenceLogger

func SilenceLogger(ctx context.Context) context.Context

func Sleep

func Sleep(ctx context.Context, amount time.Duration) error

func WithErrorHandler

func WithErrorHandler(ctx context.Context, errorHandler ErrorHandler) context.Context

func WithExistingLogger added in v0.13.3

func WithExistingLogger(ctx context.Context, logger *zap.SugaredLogger) context.Context

func WithLogger

func WithLogger(ctx context.Context, name string) context.Context

func WithLoggerValues

func WithLoggerValues(ctx context.Context, meta ...interface{}) context.Context

Types

type Backoff

type Backoff interface {
	Backoff(ctx context.Context, f func(ctx context.Context) error) error
}

func NewExponentialBackoff added in v0.21.19

func NewExponentialBackoff(eb ExponentialBackoff) Backoff

func NewExponentioalBackoff deprecated

func NewExponentioalBackoff(eb ExponentioalBackoff) Backoff

Deprecated: Deprecated due to typo; use NewExponentialBackoff instead

type ErrorHandler

type ErrorHandler interface {
	HandleErr(error)
}

func ErrorHandlerFrom

func ErrorHandlerFrom(ctx context.Context) ErrorHandler

type ErrorLogger

type ErrorLogger struct {
	// contains filtered or unexported fields
}

func (*ErrorLogger) HandleErr

func (h *ErrorLogger) HandleErr(err error)

type ExponentialBackoff added in v0.21.19

type ExponentialBackoff struct {
	MaxRetries  uint
	MaxDuration *time.Duration
	MaxDelay    *time.Duration
}

type ExponentioalBackoff deprecated

type ExponentioalBackoff = ExponentialBackoff

Deprecated: Deprecated due to typo; use ExponentialBackoff instead

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL