Better logging
This commit is contained in:
parent
1a02fe42c1
commit
7e892859c3
7
main.go
7
main.go
|
@ -25,6 +25,7 @@ func WaitUntilNextMinute() {
|
||||||
func CheckNotifications() {
|
func CheckNotifications() {
|
||||||
var prevHasNewNotes bool
|
var prevHasNewNotes bool
|
||||||
for {
|
for {
|
||||||
|
log.Println("Checking notifications ...")
|
||||||
hasNewNotes, err := sn.CheckNotifications()
|
hasNewNotes, err := sn.CheckNotifications()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
SendErrorToDiscord(err)
|
SendErrorToDiscord(err)
|
||||||
|
@ -32,9 +33,9 @@ func CheckNotifications() {
|
||||||
if !prevHasNewNotes && hasNewNotes {
|
if !prevHasNewNotes && hasNewNotes {
|
||||||
// only send embed on "rising edge"
|
// only send embed on "rising edge"
|
||||||
SendNotificationsEmbedToDiscord()
|
SendNotificationsEmbedToDiscord()
|
||||||
log.Println("Forwarded to monitoring")
|
log.Println("Forwarded notifications to monitoring")
|
||||||
} else if hasNewNotes {
|
} else if hasNewNotes {
|
||||||
log.Println("Already forwarded")
|
log.Println("Notifications already forwarded")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
prevHasNewNotes = hasNewNotes
|
prevHasNewNotes = hasNewNotes
|
||||||
|
@ -61,12 +62,12 @@ func main() {
|
||||||
var dupesErr *sn.DupesError
|
var dupesErr *sn.DupesError
|
||||||
if errors.As(err, &dupesErr) {
|
if errors.As(err, &dupesErr) {
|
||||||
// SendDupesErrorToDiscord(story.ID, dupesErr)
|
// SendDupesErrorToDiscord(story.ID, dupesErr)
|
||||||
|
log.Println(dupesErr)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
SendErrorToDiscord(err)
|
SendErrorToDiscord(err)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
log.Println("Posting to SN ... OK")
|
|
||||||
}
|
}
|
||||||
WaitUntilNextHour()
|
WaitUntilNextHour()
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue