Skip to content

Commit

Permalink
Adds verbose logging messages to cat.go
Browse files Browse the repository at this point in the history
  • Loading branch information
ma-hartma committed Sep 19, 2020
1 parent 36136a5 commit 68b6321
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions cmd/knoxite/cat.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,21 +35,32 @@ func init() {
}

func executeCat(snapshotID string, file string) error {
logger.Info("Opening repository")
repository, err := openRepository(globalOpts.Repo, globalOpts.Password)
if err != nil {
return err
}
logger.Info("Opened repository")

logger.Info(fmt.Sprintf("Finding snapshot %s", snapshotID))
_, snapshot, err := repository.FindSnapshot(snapshotID)
if err != nil {
return err
}
logger.Info(fmt.Sprintf("Found snapshot %s", snapshot.Description))

logger.Info(fmt.Sprintf("Reading snapshot %s", snapshotID))
if archive, ok := snapshot.Archives[file]; ok {
logger.Info(fmt.Sprintf("Found and read archive from location %s", archive.Path))

logger.Info("Decoding archive data")
b, _, err := knoxite.DecodeArchiveData(repository, *archive)
if err != nil {
return err
}
logger.Info("Decoded archive data")

logger.Debug("Output file content")
_, err = os.Stdout.Write(b)
return err
}
Expand Down

0 comments on commit 68b6321

Please sign in to comment.