Sha256: ab73bb49990fbff8e0a151457f31687dc8a5b6c9326b4998944fd90d51187eac

Contents?: true

Size: 1.02 KB

Versions: 16

Compression:

Stored size: 1.02 KB

Contents

package waiter

import (
	"context"
	"fmt"

	"github.com/aws/smithy-go/logging"
	"github.com/aws/smithy-go/middleware"
)

// Logger is the Logger middleware used by the waiter to log an attempt
type Logger struct {
	// Attempt is the current attempt to be logged
	Attempt int64
}

// ID representing the Logger middleware
func (*Logger) ID() string {
	return "WaiterLogger"
}

// HandleInitialize performs handling of request in initialize stack step
func (m *Logger) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) (
	out middleware.InitializeOutput, metadata middleware.Metadata, err error,
) {
	logger := middleware.GetLogger(ctx)

	logger.Logf(logging.Debug, fmt.Sprintf("attempting waiter request, attempt count: %d", m.Attempt))

	return next.HandleInitialize(ctx, in)
}

// AddLogger is a helper util to add waiter logger after `SetLogger` middleware in
func (m Logger) AddLogger(stack *middleware.Stack) error {
	return stack.Initialize.Insert(&m, "SetLogger", middleware.After)
}

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
ruby_snowflake_client-1.3.7 ext/vendor/github.com/aws/smithy-go/waiter/logger.go
ruby_snowflake_client-1.3.6 ext/vendor/github.com/aws/smithy-go/waiter/logger.go
ruby_snowflake_client-1.3.5 ext/vendor/github.com/aws/smithy-go/waiter/logger.go
ruby_snowflake_client-1.3.4 ext/vendor/github.com/aws/smithy-go/waiter/logger.go
ruby_snowflake_client-1.3.4.pre.debug ext/vendor/github.com/aws/smithy-go/waiter/logger.go
ruby_snowflake_client-1.3.3.pre.debug ext/vendor/github.com/aws/smithy-go/waiter/logger.go
ruby_snowflake_client-1.3.2 ext/vendor/github.com/aws/smithy-go/waiter/logger.go
ruby_snowflake_client-1.3.1 ext/vendor/github.com/aws/smithy-go/waiter/logger.go
ruby_snowflake_client-1.3.0 ext/vendor/github.com/aws/smithy-go/waiter/logger.go
ruby_snowflake_client-1.2.1 ext/vendor/github.com/aws/smithy-go/waiter/logger.go
ruby_snowflake_client-1.2.0 ext/vendor/github.com/aws/smithy-go/waiter/logger.go
ruby_snowflake_client-1.1.1 ext/vendor/github.com/aws/smithy-go/waiter/logger.go
ruby_snowflake_client-1.1.0 ext/vendor/github.com/aws/smithy-go/waiter/logger.go
ruby_snowflake_client-1.0.2 ext/vendor/github.com/aws/smithy-go/waiter/logger.go
ruby_snowflake_client-1.0.1 ext/vendor/github.com/aws/smithy-go/waiter/logger.go
ruby_snowflake_client-1.0.0 ext/vendor/github.com/aws/smithy-go/waiter/logger.go