mirror of
https://github.com/zitadel/zitadel.git
synced 2024-12-13 11:34:26 +00:00
25 lines
722 B
Go
25 lines
722 B
Go
|
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(),
|
||
|
"triggering_event_type", message.GetTriggeringEvent().Type(),
|
||
|
)
|
||
|
logEntry.Debug("sending notification")
|
||
|
err := channel.HandleMessage(message)
|
||
|
logEntry.OnError(err).Warn("sending notification failed")
|
||
|
logEntry.Debug("notification sent")
|
||
|
return err
|
||
|
})
|
||
|
}
|