From f292b562e2e38fc77a4ef4878fa61b2a3063502f Mon Sep 17 00:00:00 2001 From: Derek McGowan Date: Fri, 10 Jul 2015 17:10:23 -0700 Subject: [PATCH] Use logrus instead of fmt.Println Signed-off-by: Derek McGowan (github: dmcgowan) --- client/changelist/changelist.go | 5 +++-- client/changelist/files_changelist.go | 4 ++-- client/client.go | 7 +++---- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/client/changelist/changelist.go b/client/changelist/changelist.go index e6b16df855..6a280e3712 100644 --- a/client/changelist/changelist.go +++ b/client/changelist/changelist.go @@ -3,8 +3,9 @@ package changelist import ( "bufio" "encoding/json" - "fmt" "os" + + "github.com/Sirupsen/logrus" ) // AppendChangelist represents a list of TUF changes @@ -38,7 +39,7 @@ func (cl *AppendChangelist) List() []Change { err := json.Unmarshal(line, c) if err != nil { // TODO(david): How should we handle this? - fmt.Println(err.Error()) + logrus.Warn(err.Error()) continue } changes = append(changes, c) diff --git a/client/changelist/files_changelist.go b/client/changelist/files_changelist.go index 42f201b24e..50a503bd5c 100644 --- a/client/changelist/files_changelist.go +++ b/client/changelist/files_changelist.go @@ -48,14 +48,14 @@ func (cl FileChangelist) List() []Change { raw, err := ioutil.ReadFile(path.Join(cl.dir, f.Name())) if err != nil { // TODO(david): How should we handle this? - fmt.Println(err.Error()) + logrus.Warn(err.Error()) continue } c := &TufChange{} err = json.Unmarshal(raw, c) if err != nil { // TODO(david): How should we handle this? - fmt.Println(err.Error()) + logrus.Warn(err.Error()) continue } changes = append(changes, c) diff --git a/client/client.go b/client/client.go index 350ef4344b..b3122a26c2 100644 --- a/client/client.go +++ b/client/client.go @@ -111,7 +111,7 @@ func NewNotaryRepository(baseDir, gun, baseURL string, rt http.RoundTripper) (*N return nil, err } - fmt.Println("creating non-root cryptoservice") + logrus.Debugf("creating non-root cryptoservice") signer := signed.NewSigner(NewCryptoService(gun, privKeyStore)) nRepo := &NotaryRepository{ @@ -430,7 +430,7 @@ func (r *NotaryRepository) bootstrapRepo() error { kdb := keys.NewDB() tufRepo := tuf.NewTufRepo(kdb, r.signer) - fmt.Println("Loading trusted collection.") + logrus.Debugf("Loading trusted collection.") rootJSON, err := fileStore.GetMeta("root", 0) if err != nil { return err @@ -479,7 +479,7 @@ func (r *NotaryRepository) saveMetadata(rootSigner *signed.Signer) error { } func (r *NotaryRepository) snapshot() error { - fmt.Println("Saving changes to Trusted Collection.") + logrus.Debugf("Saving changes to Trusted Collection.") for t := range r.tufRepo.Targets { signedTargets, err := r.tufRepo.SignTargets(t, data.DefaultExpires("targets"), nil) @@ -641,7 +641,6 @@ func (r *NotaryRepository) GetRootSigner(rootKeyID, passphrase string) (*Unlocke // when a root key is needed. // Passing an empty GUN because root keys aren't associated with a GUN. - fmt.Println("creating root cryptoservice with passphrase", passphrase) ccs := NewCryptoService("", r.rootKeyStore) ccs.SetPassphrase(passphrase) signer := signed.NewSigner(ccs)