Skip to content

Commit eca659a

Browse files
committed
log
1 parent 3992904 commit eca659a

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

notify/notify.go

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@ package notify
22

33
import (
44
"context"
5-
"gopkg.in/telegram-bot-api.v4"
5+
"log/slog"
6+
7+
tgbotapi "gopkg.in/telegram-bot-api.v4"
68
)
79

810
var notifiers []Notifier
@@ -24,7 +26,6 @@ func NewTelegramNotifier(token string, chatID int64) (*TelegramNotifier, error)
2426
if err != nil {
2527
return nil, err
2628
}
27-
2829
return &TelegramNotifier{
2930
bot: bot,
3031
token: token,
@@ -34,8 +35,13 @@ func NewTelegramNotifier(token string, chatID int64) (*TelegramNotifier, error)
3435

3536
func (t *TelegramNotifier) Send(ctx context.Context, s string) error {
3637
msg := tgbotapi.NewMessage(t.chatID, s)
37-
_, err := t.bot.Send(msg)
38-
return err
38+
resp, err := t.bot.Send(msg)
39+
if err != nil {
40+
slog.Error("send message error", "error", err.Error())
41+
return err
42+
}
43+
slog.Info("send message success", "resp", resp)
44+
return nil
3945
}
4046

4147
func Init() {

0 commit comments

Comments
 (0)