mirror of
https://github.com/zitadel/zitadel.git
synced 2024-12-20 23:07:33 +00:00
30 lines
681 B
Go
30 lines
681 B
Go
|
package log
|
||
|
|
||
|
import (
|
||
|
"fmt"
|
||
|
|
||
|
"github.com/k3a/html2text"
|
||
|
|
||
|
"github.com/caos/logging"
|
||
|
"github.com/caos/zitadel/internal/notification/channels"
|
||
|
)
|
||
|
|
||
|
func InitStdoutChannel(config LogConfig) channels.NotificationChannel {
|
||
|
|
||
|
logging.Log("NOTIF-D0164").Debug("successfully initialized stdout email and sms channel")
|
||
|
|
||
|
return channels.HandleMessageFunc(func(message channels.Message) error {
|
||
|
|
||
|
content := message.GetContent()
|
||
|
if config.Compact {
|
||
|
content = html2text.HTML2Text(content)
|
||
|
}
|
||
|
|
||
|
logging.Log("NOTIF-c73ba").WithFields(map[string]interface{}{
|
||
|
"type": fmt.Sprintf("%T", message),
|
||
|
"content": content,
|
||
|
}).Info("handling notification message")
|
||
|
return nil
|
||
|
})
|
||
|
}
|