Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Event ¶
type Event struct { Level Level `json:"level"` Fields Fields `json:"fields"` Timestamp int64 `json:"timestamp"` Message string `json:"message"` }
Event represents a single log event
type Log ¶
type Log interface { Init(opts ...Option) error Options() Options // the logging interface Logger // We could be flushing logs on an interval basis // Or sending specific stats to the log service // Or receive events about changing log config Start() error Stop() error // Name String() string }
A structure log interface which can output to multiple backends.
type Logger ¶
type Logger interface { // Logger interface Debug(args ...interface{}) Info(args ...interface{}) Error(args ...interface{}) Fatal(args ...interface{}) // Formatted logger Debugf(format string, args ...interface{}) Infof(format string, args ...interface{}) Errorf(format string, args ...interface{}) Fatalf(format string, args ...interface{}) // Specify your own levels Log(l Level, args ...interface{}) Logf(l Level, format string, args ...interface{}) // Returns with extra fields WithFields(f Fields) Logger }
type Output ¶
type Output interface { // Send an event Send(*Event) error // Flush any buffered events Flush() error // Discard the output Close() error // Name of output String() string }
An output represents a file, indexer, syslog, etc
func NewOutput ¶
func NewOutput(opts ...OutputOption) Output
type OutputOption ¶
type OutputOption func(o *OutputOptions)
func OutputName ¶
func OutputName(name string) OutputOption
type OutputOptions ¶
type OutputOptions struct { // filepath, url, etc Name string }
Click to show internal directories.
Click to hide internal directories.