Documentation
¶
Overview ¶
Package email allows for log messages to be sent via email.
Example ¶
simple email
package main import ( "github.com/go-playground/log" "github.com/go-playground/log/handlers/email" ) func main() { email := email.New("smtp.gmail.com", 587, "username", "password", "from@email.com", []string{"to@email.com"}) log.AddHandler(email, log.WarnLevel, log.AlertLevel, log.PanicLevel) log.WithField("omg", "something went wrong").Alert("ALERT!") }
Index ¶
- type Email
- func (email *Email) From() string
- func (email *Email) Log(e log.Entry)
- func (email *Email) SetFormatFunc(fn FormatFunc)
- func (email *Email) SetTemplate(htmlTemplate string)
- func (email *Email) SetTimestampFormat(format string)
- func (email *Email) Template() *template.Template
- func (email *Email) To() []string
- type FormatFunc
- type Formatter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Email ¶
type Email struct {
// contains filtered or unexported fields
}
Email is an instance of the email logger
func (*Email) SetFormatFunc ¶
func (email *Email) SetFormatFunc(fn FormatFunc)
SetFormatFunc sets FormatFunc each worker will call to get a Formatter func
func (*Email) SetTemplate ¶
SetTemplate sets Email's html template to be used for email body
func (*Email) SetTimestampFormat ¶
SetTimestampFormat sets Email's timestamp output format Default is : "2006-01-02T15:04:05.000000000Z07:00"
type FormatFunc ¶
FormatFunc is the function that the workers use to create a new Formatter per worker allowing reusable go routine safe variable to be used within your Formatter function.
Click to show internal directories.
Click to hide internal directories.