🧪 Add more debug logs

This commit is contained in:
LittleSheep 2024-02-08 12:35:52 +08:00
parent 37f10e708e
commit 42c3770231
2 changed files with 8 additions and 1 deletions

View File

@ -42,6 +42,8 @@ func main() {
// All the things are optional so when error occurred the server won't crash // All the things are optional so when error occurred the server won't crash
if err := external.SetupFirebase(viper.GetString("external.firebase.credentials")); err != nil { if err := external.SetupFirebase(viper.GetString("external.firebase.credentials")); err != nil {
log.Error().Err(err).Msg("An error occurred when starting firebase communicating...") log.Error().Err(err).Msg("An error occurred when starting firebase communicating...")
} else {
log.Info().Msg("Successfully setup firebase communication.")
} }
// Server // Server

View File

@ -75,8 +75,13 @@ func NewNotification(
Token: subscriber.DeviceID, Token: subscriber.DeviceID,
} }
if _, err = client.Send(ctx, message); err != nil { if response, err := client.Send(ctx, message); err != nil {
log.Warn().Err(err).Msg("An error occurred when notify subscriber though firebase FCM...") log.Warn().Err(err).Msg("An error occurred when notify subscriber though firebase FCM...")
} else {
log.Debug().
Str("response", response).
Int("subscriber", int(subscriber.ID)).
Msg("Notified to subscriber though firebase FCM.")
} }
} }
} }