Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clean up log output #101

Merged
merged 1 commit into from
Jan 28, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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