Skip to content

Commit

Permalink
Accept DebugLog func via options (#20)
Browse files Browse the repository at this point in the history
and generate a default DebugLog func that passes along format args.
  • Loading branch information
meatballhat authored Mar 22, 2021
1 parent 3425490 commit 45291a9
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
11 changes: 8 additions & 3 deletions client.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,14 +86,19 @@ func newClient(options *Options, clientGetter genericclioptions.RESTClientGetter
return nil, err
}

debugLog := options.DebugLog
if debugLog == nil {
debugLog = func(format string, v ...interface{}) {
log.Printf(format, v...)
}
}

actionConfig := new(action.Configuration)
err = actionConfig.Init(
clientGetter,
settings.Namespace(),
os.Getenv("HELM_DRIVER"),
func(format string, v ...interface{}) {
log.Printf(format, v)
},
debugLog,
)
if err != nil {
return nil, err
Expand Down
1 change: 1 addition & 0 deletions types.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ type Options struct {
RepositoryCache string
Debug bool
Linting bool
DebugLog action.DebugLog
}

// RESTClientGetter defines the values of a helm REST client
Expand Down

0 comments on commit 45291a9

Please sign in to comment.