From caac05fd421fe9abb5ba57cded2e22adc6efaf5a Mon Sep 17 00:00:00 2001 From: Caleb Foust Date: Mon, 25 Dec 2023 06:29:37 -0800 Subject: [PATCH] feat: log toast errors to logs --- cmd/cy/main.go | 2 -- pkg/cy/client.go | 9 +++++---- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/cmd/cy/main.go b/cmd/cy/main.go index 14eed68d..4273ff66 100644 --- a/cmd/cy/main.go +++ b/cmd/cy/main.go @@ -28,8 +28,6 @@ func main() { Summary: true, })) - log.Logger = log.Logger.With().Int("pid", os.Getpid()).Logger() - var socketPath string if envPath, ok := os.LookupEnv(CY_SOCKET_ENV); ok { diff --git a/pkg/cy/client.go b/pkg/cy/client.go index 6a76de55..a9f9d71c 100644 --- a/pkg/cy/client.go +++ b/pkg/cy/client.go @@ -24,7 +24,6 @@ import ( "github.com/cfoust/cy/pkg/taro" "github.com/cfoust/cy/pkg/util" - "github.com/rs/zerolog/log" "github.com/sasha-s/go-deadlock" "github.com/xo/terminfo" ) @@ -136,12 +135,14 @@ func (c *Client) runAction(event bind.BindEvent) { return } - log.Error().Err(err).Msgf("failed to run callback") - c.toast.Error(fmt.Sprintf( + msg := fmt.Sprintf( "an error occurred while running %+v: %s", event.Sequence, err.Error(), - )) + ) + + c.cy.log.Error().Msg(msg) + c.toast.Error(msg) } func (c *Client) interact(out chan historyEvent) {