mirror of
https://github.com/zitadel/zitadel.git
synced 2024-12-14 20:08:02 +00:00
7d2d85f57c
# 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>
33 lines
757 B
Go
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
|
|
})
|
|
}
|