🔊 Log sample of notifications

This commit is contained in:
LittleSheep 2024-12-21 15:49:44 +08:00
parent c8ea59aa2a
commit 72506a4055

View File

@ -2,11 +2,12 @@ package provider
import ( import (
"fmt" "fmt"
"sync"
"time"
"git.solsynth.dev/hypernet/pusher/pkg/pushkit" "git.solsynth.dev/hypernet/pusher/pkg/pushkit"
"github.com/google/uuid" "github.com/google/uuid"
"github.com/rs/zerolog/log" "github.com/rs/zerolog/log"
"sync"
"time"
) )
var notifyProviders = make(map[string]NotificationProvider) var notifyProviders = make(map[string]NotificationProvider)
@ -22,6 +23,7 @@ func PushNotification(in pushkit.NotificationPushRequest) error {
Str("provider", in.Provider). Str("provider", in.Provider).
Str("topic", in.Notification.Topic). Str("topic", in.Notification.Topic).
Str("request_id", requestId). Str("request_id", requestId).
Any("body", in.Notification).
Msg("Pushing notification...") Msg("Pushing notification...")
prov, ok := notifyProviders[in.Provider] prov, ok := notifyProviders[in.Provider]
@ -60,6 +62,7 @@ func PushNotificationBatch(in pushkit.NotificationPushBatchRequest) {
Any("tk", in.Tokens). Any("tk", in.Tokens).
Any("providers", in.Providers). Any("providers", in.Providers).
Str("topic", in.Notification.Topic). Str("topic", in.Notification.Topic).
Any("body", in.Notification).
Str("request_id", requestId). Str("request_id", requestId).
Msg("Pushing notification in batch...") Msg("Pushing notification in batch...")