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 NewBatchingHook ¶
func NewHookWithDuration ¶
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.
type WriterHook ¶
type WriterHook struct {
// contains filtered or unexported fields
}
WriterHook is a hook that just outputs to an io.Writer. This is useful because our formatter outputs the file and line where it was called, and the callstack for a hook is different from the callstack for just writing to logrus.Logger.Out.
func NewWriterHook ¶
func NewWriterHook(w io.Writer) *WriterHook
func (*WriterHook) Levels ¶
func (h *WriterHook) Levels() []logrus.Level