Skip to content

Commit

Permalink
remove prints in repo
Browse files Browse the repository at this point in the history
Signed-off-by: Asra Ali <[email protected]>
  • Loading branch information
asraa committed Sep 16, 2022
1 parent 76386af commit 89b085e
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions repo.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ func (r *Repo) Init(consistentSnapshot bool) error {
return err
}

fmt.Println("Repository initialized")
r.logger.Println("Repository initialized")
return nil
}

Expand Down Expand Up @@ -574,7 +574,7 @@ func (r *Repo) RevokeKeyWithExpires(keyRole, id string, expires time.Time) error

err = r.setMeta("root.json", root)
if err == nil {
fmt.Println("Revoked", keyRole, "key with ID", id, "in root metadata")
r.logger.Println("Revoked", keyRole, "key with ID", id, "in root metadata")
}
return err
}
Expand Down Expand Up @@ -824,7 +824,7 @@ func (r *Repo) Sign(roleFilename string) error {
r.meta[roleFilename] = b
err = r.local.SetMeta(roleFilename, b)
if err == nil {
fmt.Println("Signed", roleFilename, "with", numKeys, "key(s)")
r.logger.Println("Signed", roleFilename, "with", numKeys, "key(s)")
}
return err
}
Expand Down Expand Up @@ -1265,7 +1265,7 @@ func (r *Repo) removeTargetsWithExpiresFromMeta(metaName string, paths []string,
for _, path := range paths {
path = util.NormalizeTarget(path)
if _, ok := t.Targets[path]; !ok {
fmt.Printf("[%v] The following target is not present: %v\n", metaName, path)
r.logger.Printf("[%v] The following target is not present: %v\n", metaName, path)
continue
}
removed = true
Expand All @@ -1285,17 +1285,17 @@ func (r *Repo) removeTargetsWithExpiresFromMeta(metaName string, paths []string,

err = r.setMeta(metaName, t)
if err == nil {
fmt.Printf("[%v] Removed targets:\n", metaName)
r.logger.Printf("[%v] Removed targets:\n", metaName)
for _, v := range removed_targets {
fmt.Println("*", v)
r.logger.Println("*", v)
}
if len(t.Targets) != 0 {
fmt.Printf("[%v] Added/staged targets:\n", metaName)
r.logger.Printf("[%v] Added/staged targets:\n", metaName)
for k := range t.Targets {
fmt.Println("*", k)
r.logger.Println("*", k)
}
} else {
fmt.Printf("[%v] There are no added/staged targets\n", metaName)
r.logger.Printf("[%v] There are no added/staged targets\n", metaName)
}
}
return err
Expand Down Expand Up @@ -1349,7 +1349,7 @@ func (r *Repo) SnapshotWithExpires(expires time.Time) error {
}
err = r.setMeta("snapshot.json", snapshot)
if err == nil {
fmt.Println("Staged snapshot.json metadata with expiration date:", snapshot.Expires)
r.logger.Println("Staged snapshot.json metadata with expiration date:", snapshot.Expires)
}
return err
}
Expand Down Expand Up @@ -1381,7 +1381,7 @@ func (r *Repo) TimestampWithExpires(expires time.Time) error {

err = r.setMeta("timestamp.json", timestamp)
if err == nil {
fmt.Println("Staged timestamp.json metadata with expiration date:", timestamp.Expires)
r.logger.Println("Staged timestamp.json metadata with expiration date:", timestamp.Expires)
}
return err
}
Expand Down Expand Up @@ -1547,15 +1547,15 @@ func (r *Repo) Commit() error {

err = r.local.Commit(root.ConsistentSnapshot, versions, hashes)
if err == nil {
fmt.Println("Committed successfully")
r.logger.Println("Committed successfully")
}
return err
}

func (r *Repo) Clean() error {
err := r.local.Clean()
if err == nil {
fmt.Println("Removed all staged metadata and target files")
r.logger.Println("Removed all staged metadata and target files")
}
return err
}
Expand Down

0 comments on commit 89b085e

Please sign in to comment.