mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-25 16:25:16 +00:00
add fields to slack notifier logs
This commit is contained in:
parent
b22e0370b3
commit
c96845ff6a
|
@ -4,7 +4,7 @@ import (
|
|||
"context"
|
||||
"fmt"
|
||||
|
||||
"github.com/sirupsen/logrus"
|
||||
log "github.com/sirupsen/logrus"
|
||||
"github.com/slack-go/slack"
|
||||
)
|
||||
|
||||
|
@ -69,13 +69,15 @@ func (n *Notifier) NotifyTo(channel, format string, args ...interface{}) {
|
|||
nonSlackArgs = args[:slackArgsOffset]
|
||||
}
|
||||
|
||||
logrus.Infof(format, nonSlackArgs...)
|
||||
log.Infof(format, nonSlackArgs...)
|
||||
|
||||
_, _, err := n.client.PostMessageContext(context.Background(), channel,
|
||||
slack.MsgOptionText(fmt.Sprintf(format, nonSlackArgs...), true),
|
||||
slack.MsgOptionAttachments(slackAttachments...))
|
||||
if err != nil {
|
||||
logrus.WithError(err).Errorf("slack error: %s", err.Error())
|
||||
log.WithError(err).
|
||||
WithField("channel", channel).
|
||||
Errorf("slack error: %s", err.Error())
|
||||
}
|
||||
|
||||
return
|
||||
|
|
Loading…
Reference in New Issue
Block a user