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) { func loadConfig(path string) (config.Project, error) {
p, path, err := loadConfigCheck(path) p, path, err := loadConfigCheck(path)
if err == nil { if err == nil {
log.WithField("path", path).Info("loading") log.WithField("path", path).Debug("using configuration")
} }
return p, err 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 { return func(cmd *cobra.Command, args []string) error {
start := time.Now() start := time.Now()
log.Infof(boldStyle.Render(fmt.Sprintf("starting %s...", verb)))
if err := rune(cmd, args); err != nil { 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)))) 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, ctx.Config.Release.GitHub.Name,
data, data,
) )
if err == nil { log.WithField("name", data.GetName()).
log.WithField("name", data.GetName()). WithField("release-id", release.GetID()).
WithField("release-id", release.GetID()). WithField("request-id", resp.Header.Get("X-GitHub-Request-Id")).
WithField("request-id", resp.Header.Get("X-GitHub-Request-Id")). Debug("release created")
Info("release created")
}
return release, err return release, err
} }
@ -471,12 +469,10 @@ func (c *githubClient) updateRelease(ctx *context.Context, id int64, data *githu
id, id,
data, data,
) )
if err == nil { log.WithField("name", data.GetName()).
log.WithField("name", data.GetName()). WithField("release-id", release.GetID()).
WithField("release-id", release.GetID()). WithField("request-id", resp.Header.Get("X-GitHub-Request-Id")).
WithField("request-id", resp.Header.Get("X-GitHub-Request-Id")). Debug("release updated")
Info("release updated")
}
return release, err return release, err
} }

View File

@ -23,8 +23,10 @@ func Log(title string, next middleware.Action) middleware.Action {
logDuration(start) logDuration(start)
log.ResetPadding() log.ResetPadding()
}() }()
log.Infof(bold.Render(title)) if title != "" {
log.IncreasePadding() log.Infof(bold.Render(title))
log.IncreasePadding()
}
return next(ctx) return next(ctx)
} }
} }
@ -46,7 +48,7 @@ func PadLog(title string, next middleware.Action) middleware.Action {
} }
func logDuration(start time.Time) { 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))) 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") 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 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{}{ Extra: map[string]interface{}{
artifact.ExtraChecksumOf: art.Path, artifact.ExtraChecksumOf: art.Path,
artifact.ExtraRefresh: func() error { artifact.ExtraRefresh: func() error {
log.WithField("file", filename).Info("refreshing checksums") log.WithField("file", filename).Debug("refreshing checksums")
return refreshOne(ctx, *art, filepath) return refreshOne(ctx, *art, filepath)
}, },
}, },
@ -113,7 +113,7 @@ func singleChecksum(ctx *context.Context) error {
Name: filename, Name: filename,
Extra: map[string]interface{}{ Extra: map[string]interface{}{
artifact.ExtraRefresh: func() error { artifact.ExtraRefresh: func() error {
log.WithField("file", filename).Info("refreshing checksums") log.WithField("file", filename).Debug("refreshing checksums")
return refreshAll(ctx, filepath) return refreshAll(ctx, filepath)
}, },
}, },

View File

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

View File

@ -18,7 +18,8 @@ const (
// Pipe for gomod. // Pipe for gomod.
type Pipe struct{} type Pipe struct{}
func (Pipe) String() string { return "loading go mod information" } 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. // Default sets the pipe defaults.
func (Pipe) Default(ctx *context.Context) error { 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) 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 (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 (ArtifactsPipe) Run(ctx *context.Context) error { return writeArtifacts(ctx) }
func writeMetadata(ctx *context.Context) error { func writeMetadata(ctx *context.Context) error {
@ -72,7 +72,7 @@ func writeJSON(ctx *context.Context, j interface{}, name string) (string, error)
return "", err return "", err
} }
path := filepath.Join(ctx.Config.Dist, name) 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 { if err := os.WriteFile(path, bts, 0o644); err != nil {
return "", err return "", err
} }

View File

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