hashicorp / hc-install

Go module for downloading or locating HashiCorp binaries, verifying signatures and checksums, and asserting version constraints.

Home Page:https://pkg.go.dev/github.com/hashicorp/hc-install

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Consider allowing pass of an external logger

radeksimko opened this issue · comments

Currently much of the important stages of download or installation are logged, but consumers cannot really see any of these logs as we don't allow them to pass a logger and we automatically use a discard logger internally:

hc-install/installer.go

Lines 14 to 15 in bc88cf0

type Installer struct {
logger *log.Logger

hc-install/installer.go

Lines 22 to 27 in bc88cf0

func NewInstaller() *Installer {
discardLogger := log.New(ioutil.Discard, "", 0)
return &Installer{
logger: discardLogger,
}
}

We should consider perhaps adding SetLogger(logger *log.Logger) method or generally let people use this logging to aid debugging.