Skip to content

Commit

Permalink
Merge pull request #101 from paketo-buildpacks/log
Browse files Browse the repository at this point in the history
Clean up log output
  • Loading branch information
Daniel Mikusa authored Jan 28, 2022
2 parents e4a7618 + 646f769 commit 96f9ae9
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion application.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,10 @@ func (a Application) Contribute(layer libcnb.Layer) (libcnb.Layer, error) {
return libcnb.Layer{}, fmt.Errorf("error running build\n%w", err)
}

// In some cases, process output does not end with a clean line of output
// This resets the cursor to the beginningo of the next line so indentation lines up
a.Logger.Info()

// Persist Artifacts
artifacts, err := a.ArtifactResolver.ResolveMany(a.ApplicationPath)
if err != nil {
Expand Down Expand Up @@ -144,6 +148,7 @@ func (a Application) Contribute(layer libcnb.Layer) (libcnb.Layer, error) {
// Restore compiled artifacts
file := filepath.Join(layer.Path, "application.zip")
if _, err := os.Stat(file); err == nil {
a.Logger.Header("Restoring application artifact")
in, err := os.Open(file)
if err != nil {
return libcnb.Layer{}, fmt.Errorf("unable to open %s\n%w", file, err)
Expand All @@ -154,7 +159,7 @@ func (a Application) Contribute(layer libcnb.Layer) (libcnb.Layer, error) {
return libcnb.Layer{}, fmt.Errorf("unable to extract %s\n%w", file, err)
}
} else if err != nil && os.IsNotExist(err) {
a.Logger.Infof("Restoring multiple artifacts")
a.Logger.Header("Restoring multiple artifacts")
err := copyDirectory(layer.Path, a.ApplicationPath)
if err != nil {
return libcnb.Layer{}, fmt.Errorf("unable to restore multiple artifacts\n%w", err)
Expand Down

0 comments on commit 96f9ae9

Please sign in to comment.