1
0
mirror of https://github.com/goreleaser/goreleaser.git synced 2024-12-27 01:33:39 +02:00

fix: moving some logs to debug

This commit is contained in:
Carlos Alexandro Becker 2024-06-22 22:43:57 -03:00
parent 3353bba5aa
commit 0d1e3c023f
No known key found for this signature in database
10 changed files with 29 additions and 33 deletions

View File

@ -13,7 +13,7 @@ import (
func loadConfig(path string) (config.Project, error) {
p, path, err := loadConfigCheck(path)
if err == nil {
log.WithField("path", path).Info("loading")
log.WithField("path", path).Debug("using configuration")
}
return p, err
}

View File

@ -153,8 +153,6 @@ func timedRunE(verb string, rune func(cmd *cobra.Command, args []string) error)
return func(cmd *cobra.Command, args []string) error {
start := time.Now()
log.Infof(boldStyle.Render(fmt.Sprintf("starting %s...", verb)))
if err := rune(cmd, args); err != nil {
return wrapError(err, boldStyle.Render(fmt.Sprintf("%s failed after %s", verb, time.Since(start).Truncate(time.Second))))
}

View File

@ -448,12 +448,10 @@ func (c *githubClient) createOrUpdateRelease(ctx *context.Context, data *github.
ctx.Config.Release.GitHub.Name,
data,
)
if err == nil {
log.WithField("name", data.GetName()).
WithField("release-id", release.GetID()).
WithField("request-id", resp.Header.Get("X-GitHub-Request-Id")).
Info("release created")
}
Debug("release created")
return release, err
}
@ -471,12 +469,10 @@ func (c *githubClient) updateRelease(ctx *context.Context, id int64, data *githu
id,
data,
)
if err == nil {
log.WithField("name", data.GetName()).
WithField("release-id", release.GetID()).
WithField("request-id", resp.Header.Get("X-GitHub-Request-Id")).
Info("release updated")
}
Debug("release updated")
return release, err
}

View File

@ -23,8 +23,10 @@ func Log(title string, next middleware.Action) middleware.Action {
logDuration(start)
log.ResetPadding()
}()
if title != "" {
log.Infof(bold.Render(title))
log.IncreasePadding()
}
return next(ctx)
}
}
@ -46,7 +48,7 @@ func PadLog(title string, next middleware.Action) middleware.Action {
}
func logDuration(start time.Time) {
if took := time.Since(start).Round(time.Second); took > 0 {
if took := time.Since(start).Round(time.Second); took > 10*time.Second {
log.Info(faint.Render(fmt.Sprintf("took: %s", took)))
}
}

View File

@ -106,7 +106,7 @@ func (Pipe) Run(ctx *context.Context) error {
}
path := filepath.Join(ctx.Config.Dist, "CHANGELOG.md")
log.WithField("changelog", path).Info("writing")
log.WithField("path", path).Debug("writing changelog")
return os.WriteFile(path, []byte(ctx.ReleaseNotes), 0o644) //nolint: gosec
}

View File

@ -86,7 +86,7 @@ func splitChecksum(ctx *context.Context) error {
Extra: map[string]interface{}{
artifact.ExtraChecksumOf: art.Path,
artifact.ExtraRefresh: func() error {
log.WithField("file", filename).Info("refreshing checksums")
log.WithField("file", filename).Debug("refreshing checksums")
return refreshOne(ctx, *art, filepath)
},
},
@ -113,7 +113,7 @@ func singleChecksum(ctx *context.Context) error {
Name: filename,
Extra: map[string]interface{}{
artifact.ExtraRefresh: func() error {
log.WithField("file", filename).Info("refreshing checksums")
log.WithField("file", filename).Debug("refreshing checksums")
return refreshAll(ctx, filepath)
},
},

View File

@ -12,9 +12,7 @@ import (
// Pipe that writes the effective config file to dist.
type Pipe struct{}
func (Pipe) String() string {
return "writing effective config file"
}
func (Pipe) String() string { return "" }
// Run the pipe.
func (Pipe) Run(ctx *context.Context) (err error) {
@ -23,6 +21,6 @@ func (Pipe) Run(ctx *context.Context) (err error) {
if err != nil {
return err
}
log.WithField("config", path).Info("writing")
log.WithField("path", path).Debug("writing effective configuration")
return os.WriteFile(path, bts, 0o644) //nolint: gosec
}

View File

@ -19,6 +19,7 @@ const (
type Pipe struct{}
func (Pipe) String() string { return "loading go mod information" }
func (Pipe) Skip(ctx *context.Context) bool { return !ctx.Config.GoMod.Proxy }
// Default sets the pipe defaults.
func (Pipe) Default(ctx *context.Context) error {

View File

@ -28,10 +28,10 @@ func (Pipe) Run(ctx *context.Context) error {
return tmpl.New(ctx).ApplyAll(&ctx.Config.Metadata.ModTimestamp)
}
func (MetaPipe) String() string { return "storing release metadata" }
func (MetaPipe) String() string { return "writing release metadata" }
func (MetaPipe) Run(ctx *context.Context) error { return writeMetadata(ctx) }
func (ArtifactsPipe) String() string { return "storing artifacts metadata" }
func (ArtifactsPipe) String() string { return "writing artifacts metadata" }
func (ArtifactsPipe) Run(ctx *context.Context) error { return writeArtifacts(ctx) }
func writeMetadata(ctx *context.Context) error {
@ -72,7 +72,7 @@ func writeJSON(ctx *context.Context, j interface{}, name string) (string, error)
return "", err
}
path := filepath.Join(ctx.Config.Dist, name)
log.Log.WithField("file", path).Info("writing")
log.Log.WithField("path", path).Debug("writing")
if err := os.WriteFile(path, bts, 0o644); err != nil {
return "", err
}

View File

@ -106,16 +106,17 @@ func (Pipe) Publish(ctx *context.Context) error {
if err := doPublish(ctx, c); err != nil {
return err
}
if !ctx.Config.Release.Draft {
log.WithField("url", ctx.ReleaseURL).
WithField("published", !ctx.Config.Release.Draft).
Info("release created/updated")
Info("release published")
}
return nil
}
func doPublish(ctx *context.Context, client client.Client) error {
log.WithField("tag", ctx.Git.CurrentTag).
WithField("repo", ctx.Config.Release.GitHub.String()).
Info("creating or updating release")
Info("releasing")
if err := ctx.Artifacts.Refresh(); err != nil {
return err
}