mirror of
https://github.com/zitadel/zitadel.git
synced 2025-08-12 14:47:33 +00:00
chore: move the go code into a subfolder
This commit is contained in:
32
apps/api/internal/notification/channels/log/channel.go
Normal file
32
apps/api/internal/notification/channels/log/channel.go
Normal file
@@ -0,0 +1,32 @@
|
||||
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
|
||||
})
|
||||
}
|
Reference in New Issue
Block a user