mirror of
https://github.com/zitadel/zitadel.git
synced 2024-12-16 04:48:04 +00:00
25ef3da9d5
chore(fmt): run gci on complete project Fix global import formatting in go code by running the `gci` command. This allows us to just use the command directly, instead of fixing the import order manually for the linter, on each PR. Co-authored-by: Elio Bischof <elio@zitadel.com>
33 lines
725 B
Go
33 lines
725 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.Log("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.Log("NOTIF-c73ba").WithFields(map[string]interface{}{
|
|
"type": fmt.Sprintf("%T", message),
|
|
"content": content,
|
|
}).Info("handling notification message")
|
|
return nil
|
|
})
|
|
}
|