package main
import (
"fmt"
"github.com/Lee303/logrus-mail-hook"
log "github.com/Sirupsen/logrus"
)
// Initialise mail interface implementation NewPlainAuthMail for plain-text authentication
mail, err := logrus_mail.NewPlainAuthMail("127.0.0.1", 25, "me@test.com", []string{"you@test.com"}, "me@test.com", "reallystrongpassword")
if err != nil {
println(fmt.Sprintf("Failed to initialise mail hook mailer [%s]", err))
}
// Add mail interface to mail hook with error level
mailHook, err := logrus_mail.NewMailHook(mail, []log.Level{log.ErrorLevel})
if err != nil {
println(fmt.Sprintf("Failed to create mail hook [%s]", err))
}
// Add mail hook to logrus
log.AddHook(mailHook)
// Fire a test
log.Errorf("test")
forked from 0x4c6565/logrus-mail-hook
-
Notifications
You must be signed in to change notification settings - Fork 0
Xiol/logrus-mail-hook
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
About
No description, website, or topics provided.
Resources
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published
Languages
- Go 100.0%