github.com/tilt-dev/tilt@v0.33.15-0.20240515162809-0a22ed45d8a0/internal/store/buildcontrols/log.go (about) 1 package buildcontrols 2 3 import ( 4 "context" 5 6 "github.com/tilt-dev/tilt/internal/ospath" 7 "github.com/tilt-dev/tilt/pkg/logger" 8 "github.com/tilt-dev/tilt/pkg/model" 9 ) 10 11 type BuildEntry struct { 12 Name model.ManifestName 13 BuildReason model.BuildReason 14 FilesChanged []string 15 } 16 17 func LogBuildEntry(ctx context.Context, entry BuildEntry) { 18 buildReason := entry.BuildReason 19 changedFiles := entry.FilesChanged 20 firstBuild := buildReason.Has(model.BuildReasonFlagInit) 21 22 l := logger.Get(ctx).WithFields(logger.Fields{logger.FieldNameBuildEvent: "init"}) 23 if firstBuild { 24 l.Infof("Initial Build") 25 } else { 26 if len(changedFiles) > 0 { 27 t := "File" 28 if len(changedFiles) > 1 { 29 t = "Files" 30 } 31 l.Infof("%d %s Changed: %s", len(changedFiles), t, ospath.FormatFileChangeList(changedFiles)) 32 } else { 33 l.Infof("%s", buildReason) 34 } 35 } 36 }