You've already forked goreleaser
mirror of
https://github.com/goreleaser/goreleaser.git
synced 2025-11-06 09:09:29 +02:00
feat: log duration of slow pipes (#3173)
* feat: log duration of slow pipes Signed-off-by: Carlos A Becker <caarlos0@users.noreply.github.com> * fix: do not use colors pkg Signed-off-by: Carlos A Becker <caarlos0@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
c51b0f9847
commit
cb70fa5181
@@ -1,18 +1,28 @@
|
||||
package logging
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
"github.com/caarlos0/log"
|
||||
"github.com/charmbracelet/lipgloss"
|
||||
"github.com/goreleaser/goreleaser/internal/middleware"
|
||||
"github.com/goreleaser/goreleaser/pkg/context"
|
||||
)
|
||||
|
||||
var bold = lipgloss.NewStyle().Bold(true)
|
||||
var (
|
||||
bold = lipgloss.NewStyle().Bold(true)
|
||||
faint = lipgloss.NewStyle().Italic(true).Faint(true)
|
||||
)
|
||||
|
||||
// Log pretty prints the given action and its title.
|
||||
func Log(title string, next middleware.Action) middleware.Action {
|
||||
return func(ctx *context.Context) error {
|
||||
start := time.Now()
|
||||
defer func() {
|
||||
if took := time.Since(start).Round(time.Second); took > 0 {
|
||||
log.Info(faint.Render(fmt.Sprintf("took: %s", took)))
|
||||
}
|
||||
log.ResetPadding()
|
||||
}()
|
||||
log.Infof(bold.Render(title))
|
||||
|
||||
Reference in New Issue
Block a user