Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var BufSize uint = 8192
Set graylog.BufSize = <value> _before_ calling NewGraylogHook Once the buffer is full, logging will start blocking, waiting for slots to be available in the queue.
Functions ¶
This section is empty.
Types ¶
type GraylogHook ¶
type GraylogHook struct { Facility string Extra map[string]interface{} // contains filtered or unexported fields }
GraylogHook to send logs to a logging service compatible with the Graylog API and the GELF format.
func NewAsyncGraylogHook ¶ added in v1.1.0
func NewAsyncGraylogHook(addr string, facility string, extra map[string]interface{}) *GraylogHook
NewAsyncGraylogHook creates a hook to be added to an instance of logger. The hook created will be asynchronous, and it's the responsability of the user to call the Flush method to empty the log queue.
func NewGraylogHook ¶
func NewGraylogHook(addr string, facility string, extra map[string]interface{}) *GraylogHook
NewGraylogHook creates a hook to be added to an instance of logger.
func (*GraylogHook) Fire ¶
func (hook *GraylogHook) Fire(entry *logrus.Entry) error
Fire is called when a log event is fired. We assume the entry will be altered by another hook, otherwise we might logging something wrong to Graylog
func (*GraylogHook) Flush ¶ added in v1.1.0
func (hook *GraylogHook) Flush()
Flush waits for the log queue to be empty. This func is meant to be used when the hook was created with NewAsyncGraylogHook.
func (*GraylogHook) Levels ¶
func (hook *GraylogHook) Levels() []logrus.Level
Levels returns the available logging levels.