Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DevFormatter ¶
type DevFormatter struct { HTTPRequestKey string *logrus.TextFormatter }
type Hook ¶
type Hook struct {
// contains filtered or unexported fields
}
func NewHook ¶
func NewHook(groupName, streamName string, sess *session.Session, batchFrequency time.Duration) (*Hook, error)
NewHook returns a new CloudWatch hook.
CloudWatch log events are sent in batches on an interval, batchFrequency. Pass 0 to send events synchronously.
func (*Hook) WithFields ¶
WithFields includes the given fields to log entries sent to CloudWatch.
func (*Hook) WithFormatter ¶
WithFormatter uses the given formatter to format log entries sent to CloudWatch.
type Marshaler ¶
type Marshaler interface {
MarshalLog() map[string]interface{}
}
Marshaler is an interface any type can implement to change its output in our production logs.
type ProdFormatter ¶
type ProdFormatter struct {
// contains filtered or unexported fields
}
func NewProdFormatter ¶
func NewProdFormatter(options ...ProdFormatterOption) *ProdFormatter
NewProdFormatter creates a new cloudwatchlogs production formatter. This is opinionated and you can feel free to create your own.
type ProdFormatterOption ¶
type ProdFormatterOption func(*ProdFormatter) error
func AppName ¶
func AppName(name string) ProdFormatterOption
AppName is a formatter option that specifies the name of the app. If this is not specified, the default is to use the executable name.
func HTTPRequest ¶
func HTTPRequest(key string, headerFilter ...string) ProdFormatterOption
HTTPRequest is a formatter option that allows you to indicate that a certain key will contain an *http.Request. If it does, it will be formatted in the output. You can provide an optional list of keys to filter out of the serialized header. This is useful so you don't include sensitive information (like the authorization header). Note: if you do not provide this and you pass in an *http.Request, it will fail because encoding/json cannot serialize *http.Request.
func Hostname ¶
func Hostname(name string) ProdFormatterOption
Hostname is a formatter option that specifies the hostname this program is running on. If this is not specified, the system's hostname will be used.