hooks

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 3, 2019 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	LoggingHubURL       string
	Senders             []string
	LogLevels           []logrus.Level
	DefaultIgnoreFields map[string]struct{}
	DefaultFilters      map[string]func(interface{}) interface{}
	BatchSizeInLines    int
	RequestSizeLimit    int
	FlushInterval       time.Duration
}

Config configuration for the logging agent hook

type LoggingHubEntriesReq

type LoggingHubEntriesReq struct {
	Senders []string           `json:"senders"`
	Entries []*LoggingHubEntry `json:"entries"`
}

LoggingHubEntriesReq request for the log entries

type LoggingHubEntry

type LoggingHubEntry struct {
	Log    string            `json:"log"`
	Time   string            `json:"time"`
	Level  string            `json:"level"`
	Fields map[string]string `json:"fields"`
}

LoggingHubEntry logging hub log entry

type LoggingHubHook

type LoggingHubHook struct {
	// contains filtered or unexported fields
}

LoggingHubHook logrus hook for the logging agent

func NewLoggingHubHook

func NewLoggingHubHook(loggingHubURL string, senders []string) (*LoggingHubHook, error)

NewLoggingHubHook creates a new logging agent hook

func NewWithConfig

func NewWithConfig(conf Config) (*LoggingHubHook, error)

NewWithConfig returns initialized logrus hook by config setting.

func (*LoggingHubHook) AddFilter

func (hook *LoggingHubHook) AddFilter(name string, fn func(interface{}) interface{})

AddFilter adds a custom filter function.

func (*LoggingHubHook) AddIgnore

func (hook *LoggingHubHook) AddIgnore(name string)

AddIgnore adds field name to ignore.

func (*LoggingHubHook) Fire

func (hook *LoggingHubHook) Fire(entry *logrus.Entry) error

Fire is invoked by logrus and sends log to fluentd logger.

func (*LoggingHubHook) Flush

func (hook *LoggingHubHook) Flush()

Flush flushes the logs

func (*LoggingHubHook) Levels

func (hook *LoggingHubHook) Levels() []logrus.Level

Levels returns logging level to fire this hook.

func (*LoggingHubHook) Run

func (hook *LoggingHubHook) Run()

Run handles time based operations

func (*LoggingHubHook) SetLevels

func (hook *LoggingHubHook) SetLevels(levels []logrus.Level)

SetLevels sets logging level to fire this hook.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL