zitadel/internal/notification/channels/log/channel.go
Stefan Benz 7d2d85f57c
feat: api v2beta to api v2 (#8283)
# Which Problems Are Solved

The v2beta services are stable but not GA.

# How the Problems Are Solved

The v2beta services are copied to v2. The corresponding v1 and v2beta
services are deprecated.

# Additional Context

Closes #7236

---------

Co-authored-by: Elio Bischof <elio@zitadel.com>
2024-07-26 22:39:55 +02:00

33 lines
757 B
Go

package log
import (
"fmt"
"github.com/k3a/html2text"
"github.com/zitadel/logging"
"github.com/zitadel/zitadel/internal/notification/channels"
)
func InitStdoutChannel(config Config) channels.NotificationChannel {
logging.WithFields("logID", "NOTIF-D0164").Debug("successfully initialized stdout email and sms channel")
return channels.HandleMessageFunc(func(message channels.Message) error {
content, err := message.GetContent()
if err != nil {
return err
}
if config.Compact {
content = html2text.HTML2Text(content)
}
logging.WithFields("logID", "NOTIF-c73ba").WithFields(map[string]interface{}{
"type": fmt.Sprintf("%T", message),
"content": content,
}).Info("handling notification message")
return nil
})
}