2023-03-29 00:09:06 +02:00
|
|
|
package instrumenting
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
|
|
|
|
"github.com/zitadel/logging"
|
|
|
|
|
|
|
|
"github.com/zitadel/zitadel/internal/api/authz"
|
|
|
|
"github.com/zitadel/zitadel/internal/notification/channels"
|
|
|
|
)
|
|
|
|
|
|
|
|
func logMessages(ctx context.Context, channel channels.NotificationChannel) channels.NotificationChannel {
|
|
|
|
return channels.HandleMessageFunc(func(message channels.Message) error {
|
|
|
|
logEntry := logging.WithFields(
|
|
|
|
"instance", authz.GetInstance(ctx).InstanceID(),
|
2025-02-27 11:49:12 +01:00
|
|
|
"triggering_event_type", message.GetTriggeringEventType(),
|
2023-03-29 00:09:06 +02:00
|
|
|
)
|
|
|
|
logEntry.Debug("sending notification")
|
|
|
|
err := channel.HandleMessage(message)
|
|
|
|
logEntry.OnError(err).Warn("sending notification failed")
|
|
|
|
logEntry.Debug("notification sent")
|
|
|
|
return err
|
|
|
|
})
|
|
|
|
}
|