Skip to content

Commit

Permalink
Merge pull request #1142 from nkubala/logs
Browse files Browse the repository at this point in the history
Minor logging improvements
  • Loading branch information
nkubala authored Oct 11, 2018
2 parents e73775c + 306348d commit d4912b7
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 4 deletions.
3 changes: 3 additions & 0 deletions pkg/skaffold/bazel/bazel.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import (
"github.com/GoogleContainerTools/skaffold/pkg/skaffold/schema/latest"
"github.com/GoogleContainerTools/skaffold/pkg/skaffold/util"
"github.com/pkg/errors"
"github.com/sirupsen/logrus"
)

const sourceQuery = "kind('source file', deps('%[1]s')) union buildfiles('%[1]s')"
Expand Down Expand Up @@ -65,6 +66,8 @@ func GetDependencies(ctx context.Context, workspace string, a *latest.BazelArtif
deps = append(deps, "WORKSPACE")
}

logrus.Debugf("Found dependencies for bazel artifact: %v", deps)

return deps, nil
}

Expand Down
2 changes: 1 addition & 1 deletion pkg/skaffold/docker/parse.go
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ func expandPaths(workspace string, copied [][]string) ([]string, error) {
for dep := range expandedPaths {
deps = append(deps, dep)
}
logrus.Infof("Found dependencies for dockerfile %s", deps)
logrus.Debugf("Found dependencies for dockerfile: %v", deps)

return deps, nil
}
Expand Down
2 changes: 2 additions & 0 deletions pkg/skaffold/jib/jib_gradle.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import (
"github.com/GoogleContainerTools/skaffold/pkg/skaffold/schema/latest"
"github.com/GoogleContainerTools/skaffold/pkg/skaffold/util"
"github.com/pkg/errors"
"github.com/sirupsen/logrus"
)

var GradleCommand = util.CommandWrapper{Executable: "gradle", Wrapper: "gradlew"}
Expand All @@ -36,6 +37,7 @@ func GetDependenciesGradle(ctx context.Context, workspace string, a *latest.JibG
if err != nil {
return nil, errors.Wrapf(err, "getting jibGradle dependencies")
}
logrus.Debugf("Found dependencies for jibGradle artifact: %v", deps)
return deps, nil
}

Expand Down
2 changes: 2 additions & 0 deletions pkg/skaffold/jib/jib_maven.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import (
"github.com/GoogleContainerTools/skaffold/pkg/skaffold/schema/latest"
"github.com/GoogleContainerTools/skaffold/pkg/skaffold/util"
"github.com/pkg/errors"
"github.com/sirupsen/logrus"
)

var MavenCommand = util.CommandWrapper{Executable: "mvn", Wrapper: "mvnw"}
Expand All @@ -38,6 +39,7 @@ func GetDependenciesMaven(ctx context.Context, workspace string, a *latest.JibMa
if err != nil {
return nil, errors.Wrapf(err, "getting jibMaven dependencies")
}
logrus.Debugf("Found dependencies for jibMaven artifact: %v", deps)
return deps, nil
}

Expand Down
18 changes: 15 additions & 3 deletions pkg/skaffold/watch/changes.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,13 +105,25 @@ func events(prev, curr FileMap) Events {
}
}

sortEvt(e)
logrus.Debug(e.String())
sortEvents(e)
logEvents(e)
return e
}

func sortEvt(e Events) {
func sortEvents(e Events) {
sort.Strings(e.Added)
sort.Strings(e.Modified)
sort.Strings(e.Deleted)
}

func logEvents(e Events) {
if e.Added != nil && len(e.Added) > 0 {
logrus.Infof("files added: %v", e.Added)
}
if e.Modified != nil && len(e.Modified) > 0 {
logrus.Infof("files modified: %v", e.Modified)
}
if e.Deleted != nil && len(e.Deleted) > 0 {
logrus.Infof("files deleted: %v", e.Deleted)
}
}

0 comments on commit d4912b7

Please sign in to comment.