Skip to content

Commit

Permalink
feat: log toast errors to logs
Browse files Browse the repository at this point in the history
  • Loading branch information
cfoust committed Dec 25, 2023
1 parent 84196db commit caac05f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
2 changes: 0 additions & 2 deletions cmd/cy/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
9 changes: 5 additions & 4 deletions pkg/cy/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)
Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit caac05f

Please sign in to comment.