Skip to content

Commit

Permalink
imgutil: add logger options
Browse files Browse the repository at this point in the history
Signed-off-by: wuhenggongzi <[email protected]>
  • Loading branch information
wuhenggongzi committed Nov 10, 2024
1 parent 186f89b commit 1c31fdb
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions options.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ type ImageOptions struct {
BaseImageRepoName string
PreviousImageRepoName string
Config *v1.Config
Logger Logger
CreatedAt time.Time
MediaTypes MediaTypes
Platform Platform
Expand All @@ -43,6 +44,10 @@ type RegistrySetting struct {
Insecure bool
}

type Logger interface {
Warn(msg string)
}

// FromBaseImage loads the provided image as the manifest, config, and layers for the working image.
// If the image is not found, it does nothing.
func FromBaseImage(name string) func(*ImageOptions) {
Expand Down Expand Up @@ -99,6 +104,13 @@ func WithPreviousImage(name string) func(*ImageOptions) {
}
}

// WithLogger if provided will check if contained is used.
func WithLogger(logger Logger) func(*ImageOptions) {
return func(o *ImageOptions) {
o.Logger = logger
}
}

type IndexOption func(options *IndexOptions) error

type IndexOptions struct {
Expand Down

0 comments on commit 1c31fdb

Please sign in to comment.